:orphan:

===============================
Packaging Oracle Instant Client
===============================

If your organization requires you to download and install the Oracle Instant Client as a package---from a secure private repository, for example---you (or an Administrator) can use the following instructions to build the package.

1. Create a ``build.sh`` file that looks like the following

.. code-block:: bash

     #!/bin/sh

     cd $PREFIX
     mkdir -p share
     mkdir -p lib
     
     cd share
     unzip $RECIPE_DIR/instantclient-basic-linux.x64-${PKG_VERSION}dbru.zip
     
     cd instantclient*
     cp libclntsh.so.19.1 ../../lib/
     cp libnnz19.so ../../lib/
     cp libmql1.so ../../lib/
     cp libipc1.so ../../lib/
     cp libociei.so ../../lib/
     cp libocijdbc19.so ../../lib/
     cp liboramysql19.so ../../lib/
     cp libocci.so.19.1 ../../lib/
     cp libclntshcore.so.19.1 ../../lib

     cd ../../lib
     ln -s libclntsh.so.19.1 libclntsh.so
     ln -s libocci.so.19.1 libocci.so
     ln -s libclntshcore.so.19.1 libclntshcore.so

2. Create a ``meta.yaml`` file that looks like the following:

.. code-block:: python

     {% set version="19.3.0.0.0" %}
     package:
       name: instantclient
       version: {{ version }}

     source:
       url: ./instantclient-basic-linux.x64-{{ version }}dbru.zip

     build:
       number: 1
       
     requirements:
       build:
         - unzip

3. Download `the appropriate instantclient zip file <https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html>`_ into the same directory as the ``build.sh`` and ``meta.yaml`` files.

4. Edit ``meta.yaml`` with the absolute path to instantclient zip file.

5. If necessary, update the version in ``metadata.yaml``.

6. In a terminal, run the following::

     bash
     $ conda build oracle_instantclient

The package will be created in the directory where Anaconda is installed. 
For example, ``/Users/username/anaconda3/conda-bld/osx-64/instantclient-19.3.0.0.0.tar.bz2``.
 
7. To install the package, run::

     bash
     $ conda install --offline ./instantclient-19.3.0.0.0.tar.bz2
    
8. To verify that the installation was successful, run::

     bash
     $ conda list
     
     # packages in environment at /Users/username/anaconda3/envs/instanclient:
     #
     # Name                    Version                   Build  Channel
     instantclient             19.3.0.0.0                    1    local
 
