+-------------------------------------------------------------+
| unixODBC                                                    |
+-------------------------------------------------------------+

README
---------------------------------------------------------------

UnixODBC consists of 5 packages:
  libodbc1
  odbcinst
  odbcinst1debian2
  unixodbc
  unixodbc-dev

The source code can be found at:
  http://www.unixodbc.org/


To build these packages, the following process can be followed:

The DEBs for Debian/Ubuntu are built on an Ubuntu 14.04 machine, in order to allow for one package that is forward-compatible for all the distros. Note that unixODBC is split into 5 separate package files, named libodbc1, odbcinst, odbcinst1debian2, unixodbc, and unixodbc-dev.

Retrieve the unixODBC source package of a specific version (e.g. http://www.unixodbc.org/unixODBC-2.3.7.tar.gz for 2.3.7) and unpack it, then configure and build (make) but do not install (sudo make install) it. The configure options for Debian/Ubuntu are:

    ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --sysconfdir=/etc --enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-ucode-enc=UTF-16LE

Prepare the directory structure for the packages:

    - instroot\
    - libodbc1\
    - odbcinst\
    - odbcinst1debian2\
    - unixodbc\cd 
    - unixodbc-dev\

Install the DM into the instroot, using this command to specify it:

    make DESTDIR=/path/to/instroot install

Create a DEBIAN directory in each of the package roots, then get and copy the package metadata files into them:

    - instroot\
          etc\
             ODBCDataSources\
             odbc.ini
             odbcinst.ini
          usr\
             ... (rest of unixODBC installation files)
    - libodbc1\
          DEBIAN\
             control
             md5sums
             postinst
             postrm
             shlib
             symbols
    - odbcinst\
          DEBIAN\
             conffiles
             control
             md5sums
             postinst
             postrm
    - odbcinst1debian2\
          DEBIAN\
             control
             md5sums
             postinst
             postrm
             shlibs
             symbols
    - unixodbc\
          DEBIAN\
             control
             md5sums
    - unixodbc-dev\
          DEBIAN\
             control
             md5sums

Copy the DM's files (preserving symlinks) from the instroot into the appropriate package's root, according to the contents of original package---

libodbc1: driver manager and cursor libraries (beware of symlinks --- they need to be preserved) libodbccr.so.1, libodbccr.so.2, libodbccr.so.2.0.0, libodbc.so.1, libodbc.so.2, libodbc.so.2.0.0

odbcinst: odbc.ini (blank), odbcinst utility (run 'strip' on it first to remove unnecessary symbols), and manual pages for odbcinst, odbc.ini, and odbcinst.ini

odbcinst1debian2: etc/ODBCDataSources (empty directory), libodbcinst.so.1, libodbcinst.so.2, libodbcinst.so.2.0.0 (beware of symlinks)

unixodbc: isql, iusql (both stripped as per odbcinst above), their manual pages, and unixODBC.7 manual page

unixodbc-dev: include files in usr/include (unixodbc_conf.h needs to be moved into subdirectory x86_64-linux-gnu), .la libraries , pkgconfig directory and its contents, unversioned symlinks libodbccr.so, libodbc.so, libodbcinst.so

Edit the files in the DEBIAN\ directories to correct the version numbers and md5sums (use the find utility to execute md5sum on each of the files in the tree, and collect its output into a file, which can then be slightly edited to correct the paths.) The symbols file contains exports and their ABI versions; for unixODBC 2.3.x this should remain at 2.3.1.

Make a version-specific output directory for the packages:

    mkdir 2.3.7

Chown all the files to be root:root in the package directories:

    sudo chown -R root:root *

Build all the packages:

    for i in libodbc1 odbcinst odbcinst1debian2 unixodbc unixodbc-dev ; do sudo dpkg-deb -b $i 2.3.7 ; done

The output debs will now be located in the 2.3.7/ directory.

    libodbc1_2.3.7_amd64.deb
    odbcinst1debian2_2.3.7_amd64.deb
    odbcinst_2.3.7_amd64.deb
    unixodbc_2.3.7_amd64.deb
    unixodbc-dev_2.3.7_amd64.deb
	