<commit_before>Objective-C
===========

This README file explains how to build and install the TightDB
language binding for Objective-C. It assumes that the TightDB core
library has already been installed.


Prerequisites
-------------

You need the standard set of build tools. This includes an
Objective-C/C++ compiler and GNU make. The Objective-C language
binding is thoroughly tested with Clang. It is known to work with
Clang 3.0 and newer.

If you are going to modify the Objective-C language binding, you will
need Cheetah for Python (http://www.cheetahtemplate.org). It is needed
because some source files are generated from Cheetah templates.

Currently, the Objective-C binding is availble only on Mac OS X (and
iPhone). The following is a suggestion of how to install the
prerequisites on Mac OS X 10.7, 10.8, and 10.9:

The build procedure uses Clang as the C/C++ compiler by default. It
needs at least Clang 3.0 which comes with Xcode 4.2. On OS X 10.9
(Mavericks) we recommend at least Xcode 5.0, since in some cases when
a previous version of OS X is upgraded to 10.9, you will be left with
a malfunctioning set of command line tools (in particular the `lipo`
command), and this is most easily fixed by upgrading to Xcode 5. Run
the following command in the command prompt to see if you have Xcode
installed, and, if so, what version it is:

    xcodebuild -version

If you have Xcode 5 or later, you will already have the required
command line tools installed. In Xcode 4, however, the "Command line
tools" is an optional Xcode add-on that you must install. You can find
it under the "Downloads" pane of the "Preferences" dialog in the Xcode
4 menu.

Download the latest version of Python Cheetah
(https://pypi.python.org/packages/source/C/Cheetah/Cheetah-2.4.4.tar.gz),
then:

    tar xf Cheetah-2.4.4.tar.gz
    cd Cheetah-2.4.4/
    sudo python setup.py install



Configure, build, install
-------------------------

Run the following commands to configure, build, and install the
language binding:

    sh build.sh config
    sh build.sh build
    sudo sh build.sh install

Headers are installed in:

    /usr/local/include/tightdb/objc/

The following libraries are installed:

    /usr/local/lib/libtightdb-objc.dylib
    /usr/local/lib/libtightdb-objc-dbg.dylib

Here is a more complete set of build-related commands:

    sh build.sh config
    sh build.sh clean
    sh build.sh build
    sh build.sh test
    sh build.sh test-debug
    sh build.sh show-install
    sudo sh build.sh install
    sh build.sh test-intalled
    sudo sh build.sh uninstall



Building for iPhone
-------------------

On Mac OS X it is possible to build a version of the Objective-C
language binding for iOS (the iPhone OS). It requires that the
iPhoneOS and iPhoneSimulator SDKs for Xcode are installed.

It also requires that a prebuilt version of the core library for iOS
is available. By default, the configuration step will look for it in
`../tightdb/iphone_lib`. If this is not the correct location of it,
set the environment variable TIGHTDB_IPHONE_CORE_LIB to the correct
path before invoking the configuration step.

Run the following command to build the Objective-C language binding
for iPhone:

    sh build.sh build-iphone

This produces the following files and directories:

    iphone-lib/include/
    iphone-lib/libtightdb-objc-ios.a
    iphone-lib/libtightdb-objc-ios-dbg.a

The `include` directory holds a copy of the header files, which are
identical to the ones installed by `sh build.sh install`. There are
two versions of the static library, one that is compiled with
optimization, and one that is compiled for debugging. Each one
contains code compiled for both iPhone and for the iPhone
simulator. Each one also includes the TightDB core library and is
therefore self contained.

After building, the iPhone version of the Objective-C language binding
can be tested via the Xcode project in:

    test-iphone/



Configuration
-------------

It is possible to install into a non-default location by running the
following command before building and installing:

    sh build.sh config [PREFIX]

Here, `PREFIX` is the installation prefix. If it is not specified, it
defaults to `/usr/local`.

To use a nondefault compiler, or a compiler in a nondefault location,
set the environment variable `CC` before calling `sh build.sh build`,
as in the following example:

    CC=clang sh build.sh build



Notes
-----

Naming of database fields: Must start with capital letter.<commit_msg>README.md: Explain how to specify location of `tightdb-config`<commit_after>Objective-C
===========

This README file explains how to build and install the TightDB
language binding for Objective-C. It assumes that the TightDB core
library has already been installed.


Prerequisites
-------------

You need the standard set of build tools. This includes an
Objective-C/C++ compiler and GNU make. The Objective-C language
binding is thoroughly tested with Clang. It is known to work with
Clang 3.0 and newer.

If you are going to modify the Objective-C language binding, you will
need Cheetah for Python (http://www.cheetahtemplate.org). It is needed
because some source files are generated from Cheetah templates.

Currently, the Objective-C binding is availble only on Mac OS X (and
iPhone). The following is a suggestion of how to install the
prerequisites on Mac OS X 10.7, 10.8, and 10.9:

The build procedure uses Clang as the C/C++ compiler by default. It
needs at least Clang 3.0 which comes with Xcode 4.2. On OS X 10.9
(Mavericks) we recommend at least Xcode 5.0, since in some cases when
a previous version of OS X is upgraded to 10.9, you will be left with
a malfunctioning set of command line tools (in particular the `lipo`
command), and this is most easily fixed by upgrading to Xcode 5. Run
the following command in the command prompt to see if you have Xcode
installed, and, if so, what version it is:

    xcodebuild -version

If you have Xcode 5 or later, you will already have the required
command line tools installed. In Xcode 4, however, the "Command line
tools" is an optional Xcode add-on that you must install. You can find
it under the "Downloads" pane of the "Preferences" dialog in the Xcode
4 menu.

Download the latest version of Python Cheetah
(https://pypi.python.org/packages/source/C/Cheetah/Cheetah-2.4.4.tar.gz),
then:

    tar xf Cheetah-2.4.4.tar.gz
    cd Cheetah-2.4.4/
    sudo python setup.py install



Configure, build, install
-------------------------

Run the following commands to configure, build, and install the
language binding:

    sh build.sh config
    sh build.sh build
    sudo sh build.sh install

Headers are installed in:

    /usr/local/include/tightdb/objc/

The following libraries are installed:

    /usr/local/lib/libtightdb-objc.dylib
    /usr/local/lib/libtightdb-objc-dbg.dylib

Here is a more complete set of build-related commands:

    sh build.sh config
    sh build.sh clean
    sh build.sh build
    sh build.sh test
    sh build.sh test-debug
    sh build.sh show-install
    sudo sh build.sh install
    sh build.sh test-intalled
    sudo sh build.sh uninstall



Building for iPhone
-------------------

On Mac OS X it is possible to build a version of the Objective-C
language binding for iOS (the iPhone OS). It requires that the
iPhoneOS and iPhoneSimulator SDKs for Xcode are installed.

It also requires that a prebuilt version of the core library for iOS
is available. By default, the configuration step will look for it in
`../tightdb/iphone_lib`. If this is not the correct location of it,
set the environment variable TIGHTDB_IPHONE_CORE_LIB to the correct
path before invoking the configuration step.

Run the following command to build the Objective-C language binding
for iPhone:

    sh build.sh build-iphone

This produces the following files and directories:

    iphone-lib/include/
    iphone-lib/libtightdb-objc-ios.a
    iphone-lib/libtightdb-objc-ios-dbg.a

The `include` directory holds a copy of the header files, which are
identical to the ones installed by `sh build.sh install`. There are
two versions of the static library, one that is compiled with
optimization, and one that is compiled for debugging. Each one
contains code compiled for both iPhone and for the iPhone
simulator. Each one also includes the TightDB core library and is
therefore self contained.

After building, the iPhone version of the Objective-C language binding
can be tested via the Xcode project in:

    test-iphone/



Configuration
-------------

It is possible to install into a non-default location by running the
following command before building and installing:

    sh build.sh config [PREFIX]

Here, `PREFIX` is the installation prefix. If it is not specified, it
defaults to `/usr/local`.

By default, the configuration step uses `which tightdb-config` to
locate the installation of the TightDB core library. If this is not
appropriate, because you have multiple versions of the TightDB core
library installed, or `tightdb-config` is not available in your
`PATH`, set the environment variable `TIGHTDB_CONFIG` before calling
`sh build.sh config`. For example:

    TIGHTDB_CONFIG=/opt/tightdb-v0.1.2/bin/tightdb-config build.sh config

To use a nondefault compiler, or a compiler in a nondefault location,
set the environment variable `CC` before calling `sh build.sh build`,
as in the following example:

    CC=clang sh build.sh build



Notes
-----

Naming of database fields: Must start with capital letter.
{'fraction_non_alphanumeric': 0.06994845903018829, 'fraction_numerical': 0.007888923950773114, 'mean_word_length': 3.493383742911153, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7497571', 'n_tokens_mistral': 2760, 'n_tokens_neox': 2590, 'n_words': 1350}