Blame README.md

Packit Service 21b5d1
| Travis        | AppVeyor      | GitLab| Codecov| Repology|
Packit Service 21b5d1
|:-------------:|:-------------:|:-----:|:------:|:-------:|
Packit Service 21b5d1
| [![Build Status](https://travis-ci.org/Exiv2/exiv2.svg?branch=0.27-maintenance)](https://travis-ci.org/Exiv2/exiv2) | [![Build status](https://ci.appveyor.com/api/projects/status/d6vxf2n0cp3v88al/branch/0.27-maintenance?svg=true)](https://ci.appveyor.com/project/piponazo/exiv2-wutfp/branch/0.27-maintenance) | [![pipeline status](https://gitlab.com/D4N/exiv2/badges/0.27-maintenance/pipeline.svg)](https://gitlab.com/D4N/exiv2/commits/0.27-maintenance) | [![codecov](https://codecov.io/gh/Exiv2/exiv2/branch/0.27-maintenance/graph/badge.svg)](https://codecov.io/gh/Exiv2/exiv2) | [![Packaging status](https://repology.org/badge/tiny-repos/exiv2.svg)](https://repology.org/metapackage/exiv2/versions) |
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### TABLE OF CONTENTS
Packit Service 21b5d1
Packit Service 21b5d1
1. [Welcome to Exiv2](#1)
Packit Service 21b5d1
2. [Building, Installing, Using and Uninstalling Exiv2](#2)
Packit Service 21b5d1
    1. [Build, Install, Use and Uninstall Exiv2 on a UNIX-like system](#2-1)
Packit Service 21b5d1
    2. [Build and Install Exiv2 with Visual Studio](#2-2)
Packit Service 21b5d1
    3. [Build Options](#2-3)
Packit Service 21b5d1
    4. [Dependencies](#2-4)
Packit Service 21b5d1
    5. [Building and linking your code with Exiv2](#2-5)
Packit Service 21b5d1
    6. [Consuming Exiv2 with CMake](#2-6)
Packit Service 21b5d1
    7. [Using pkg-config to compile and link your code with Exiv2](#2-7)
Packit Service 21b5d1
    8. [Localisation](#2-8)
Packit Service 21b5d1
    9. [Building Exiv2 Documentation](#2-9)
Packit Service 21b5d1
   10. [Building Exiv2 Packages](#2-10)
Packit Service 21b5d1
   11. [Debugging Exiv2](#2-11)
Packit Service 21b5d1
   12. [Building  Exiv2 with Clang and other build chains](#2-12)
Packit Service 21b5d1
   13. [Building  Exiv2 with ccache](#2-13)
Packit Service 21b5d1
3. [License and Support](#3)
Packit Service 21b5d1
    1. [License](#3-1)
Packit Service 21b5d1
    2. [Support](#3-2)
Packit Service 21b5d1
4. [Test Suit](#4)
Packit Service 21b5d1
    1. [Running tests on a UNIX-like system](#4-1)
Packit Service 21b5d1
    2. [Running tests on Visual Studio builds](#4-2)
Packit Service 21b5d1
    3. [Unit tests](#4-3)
Packit Service 21b5d1
5. [Platform Notes](#5)
Packit Service 21b5d1
    1. [Linux](#5-1)
Packit Service 21b5d1
    2. [MacOS-X](#5-2)
Packit Service 21b5d1
    3. [MinGW](#5-3)
Packit Service 21b5d1
    4. [Cygwin](#5-4)
Packit Service 21b5d1
    5. [Microsoft Visual C++](#5-5)
Packit Service 21b5d1
    6. [Unix](#5-6)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
# Welcome to Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
![Exiv2](exiv2.png)
Packit Service 21b5d1
Packit Service 21b5d1
Exiv2 is a C++ library and a command line utility to read,
Packit Service 21b5d1
write, delete and modify Exif, IPTC, XMP and ICC image metadata.
Packit Service 21b5d1
Packit Service 21b5d1
| Exiv2 Resource              | Location |
Packit Service 21b5d1
|:------                      |:----     |
Packit Service 21b5d1
| Releases and Documentation  | [https://exiv2.org](https://exiv2.org) |
Packit Service 21b5d1
| Prereleases:                | [https://pre-release.exiv2.org](https://pre-release.exiv2.org) |
Packit Service 21b5d1
| Project Resources           | [https://github.com/Exiv2/exiv2](https://github.com/Exiv2/exiv2) |
Packit Service 21b5d1
| License (GPLv2)             | [COPYING](COPYING) |
Packit Service 21b5d1
| CMake Downloads             | [https://cmake.org/download/](https://cmake.org/download/) |
Packit Service 21b5d1
Packit Service 21b5d1
The file ReadMe.txt in a Build bundle describes how to install the library on the platform.  ReadMe.txt also documents how to compile and link code on the platform.
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
## 2 Building, Installing, Using and Uninstalling Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
You need [CMake](https://cmake.org/download/) to configure the Exiv2 project and a C++11 compiler.
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.1 Build, Install, Use Exiv2 on a UNIX-like system
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
cd $EXIV_ROOT
Packit Service 21b5d1
mkdir build && cd build
Packit Service 21b5d1
cmake .. -DCMAKE_BUILD_TYPE=Release
Packit Service 21b5d1
cmake --build .
Packit Service 21b5d1
make test
Packit Service 21b5d1
sudo make install
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
This will install the library into the "standard locations".  The library will be installed in `/usr/local/lib`, executables (including the exiv2 command-line program) in `/usr/local/bin/` and header files in `/usr/local/include/exiv2`
Packit Service 21b5d1
Packit Service 21b5d1
#### Using the exiv2 command-line program
Packit Service 21b5d1
Packit Service 21b5d1
To execute the exiv2 command line program, you should update your path to search /usr/local/bin/
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ export PATH="/usr/local/bin:$PATH"
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
You will also need to locate libexiv2 at run time:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"      # Linux, Cygwin, MinGW/msys2
Packit Service 21b5d1
$ export DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH"  # MacOS-X
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.2 Build and Install Exiv2 with Visual Studio
Packit Service 21b5d1
Packit Service 21b5d1
We recommend that you use conan to download the Exiv2 external dependencies on Windows (On Linux/OSX you can use or install system packages).
Packit Service 21b5d1
Apart from handling the dependencies, to configure and compile the project is pretty similar to the UNIX like systems.
Packit Service 21b5d1
See [README-CONAN](README-CONAN.md) for more information
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.3 Build options
Packit Service 21b5d1
Packit Service 21b5d1
There are two groups of CMake options.  There are many options defined by CMake.  Here are some particularly useful options:
Packit Service 21b5d1
Packit Service 21b5d1
| Options       | Purpose (_default_)       |
Packit Service 21b5d1
|:------------- |:------------- |
Packit Service 21b5d1
| CMAKE\_INSTALL\_PREFIX
CMAKE\_BUILD\_TYPE
BUILD\_SHARED\_LIBS | Where to install on your computer _**(/usr/local)**_
Type of build _**(Release)**_ See: [Debugging Exiv2](#2-11)
Build exiv2lib as shared or static _**(On)**_ |
Packit Service 21b5d1
Packit Service 21b5d1
Options defined by <exiv2>/CMakeLists.txt include:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
576 rmills@rmillsmm:~/gnu/github/exiv2/exiv2 $ grep ^option CMakeLists.txt
Packit Service 21b5d1
option( BUILD_SHARED_LIBS             "Build exiv2lib as a shared library"                    ON  )
Packit Service 21b5d1
option( EXIV2_ENABLE_XMP              "Build with XMP metadata support"                       ON  )
Packit Service 21b5d1
option( EXIV2_ENABLE_EXTERNAL_XMP     "Use external version of XMP"                           OFF )
Packit Service 21b5d1
option( EXIV2_ENABLE_PNG              "Build with png support (requires libz)"                ON  )
Packit Service 21b5d1
...
Packit Service 21b5d1
577 rmills@rmillsmm:~/gnu/github/exiv2/exiv2 $
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
Options are defined on the CMake command line:
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cmake -DBUILD_SHARED_LIBS=On -DEXIV2_ENABLE_NLS=OFF
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.4 Dependencies
Packit Service 21b5d1
Packit Service 21b5d1
The following Exiv2 features require external libraries:
Packit Service 21b5d1
Packit Service 21b5d1
| Feature                     | Package   |  Default | To change default             | Availability |
Packit Service 21b5d1
|:--------------------------  |:--------  |:--------:| :---------------------------- |:-----------  |
Packit Service 21b5d1
| PNG image support           | zlib      | ON       | -DEXIV2\_ENABLE\_PNG=Off      | [http://zlib.net/](http://zlib.net/) |
Packit Service 21b5d1
| XMP support                 | expat     | ON       | -DEXIV2\_ENABLE\_XMP=Off      | [http://expat.sourceforge.net](http://expat.sourceforge.net)/
Use _**Expat 2.2.6**_ and later |
Packit Service 21b5d1
| Natural language system     | gettext   | OFF      | -DEXIV2\_ENABLE\_NLS=On       | [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) |
Packit Service 21b5d1
Packit Service 21b5d1
On UNIX systems, you may install the dependencies using the distribution's package management system. Install the
Packit Service 21b5d1
development package of a dependency to install the header files and libraries required to build Exiv2. In the file
Packit Service 21b5d1
`ci/install_dependencies.sh` you can check to the list of packages we install on different Linux distributions. This
Packit Service 21b5d1
file is used to setup some CI images in which we try out the Exiv2 compilation.
Packit Service 21b5d1
Packit Service 21b5d1
Natural language system is discussed in more detail here: [Localisation](#2-8)
Packit Service 21b5d1
Packit Service 21b5d1
Notes about different platforms are included here: [Platform Notes](#5)
Packit Service 21b5d1
Packit Service 21b5d1
You may choose to install dependences with conan.  This is supported on all platforms and is especially useful for users of Visual Studio.
Packit Service 21b5d1
See [README-CONAN](README-CONAN.md) for more information.
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.5 Building and linking your code with Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
There are detailed platform notes about compiling and linking in `releasenotes/{platform}/ReadMe.txt`
Packit Service 21b5d1
Packit Service 21b5d1
where `platform: { CYGWIN | Darwin | Linux | MinGW | msvc }`
Packit Service 21b5d1
Packit Service 21b5d1
In general you need to do the following:
Packit Service 21b5d1
Packit Service 21b5d1
1) Application code should be written in C++98 and include exiv2 headers:
Packit Service 21b5d1
Packit Service 21b5d1
```C++
Packit Service 21b5d1
#include <exiv2/exiv2.hpp>
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
2) Compile your C++ code with the directive: **`-I/usr/local/include`**
Packit Service 21b5d1
Packit Service 21b5d1
3) Link your code with libexiv2 using the linker options: **`-lexiv2`** and **`-L/usr/local/lib`**
Packit Service 21b5d1
Packit Service 21b5d1
The following is a typical command to build and link with libexiv2:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ g++ -std=c++98 myprog.cpp -o myprog -I/usr/local/include -L/usr/local/lib -lexiv2
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.6 Consuming Exiv2 with CMake
Packit Service 21b5d1
Packit Service 21b5d1
When exiv2 is installed, the files required to consume Exiv2 are installed in `${CMAKE_INSTALL_PREFIX}/lib/cmake/exiv2`
Packit Service 21b5d1
Packit Service 21b5d1
You can build samples/exifprint.cpp as follows:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>
Packit Service 21b5d1
$ mkdir exifprint
Packit Service 21b5d1
$ cd    exifprint
Packit Service 21b5d1
$ *** EDIT CMakeLists.txt ***
Packit Service 21b5d1
$ cat CMakeLists.txt
Packit Service 21b5d1
cmake_minimum_required(VERSION 3.8)
Packit Service 21b5d1
project(exifprint VERSION 0.0.1 LANGUAGES CXX)
Packit Service 21b5d1
Packit Service 21b5d1
set(CMAKE_CXX_STANDARD 11)
Packit Service 21b5d1
set(CMAKE_CXX_EXTENSIONS OFF)
Packit Service 21b5d1
Packit Service 21b5d1
find_package(exiv2 REQUIRED CONFIG NAMES exiv2)    # search ${CMAKE_INSTALL_PREFIX}/lib/cmake/exiv2/
Packit Service 21b5d1
add_executable(exifprint ../samples/exifprint.cpp) # compile this
Packit Service 21b5d1
target_link_libraries(exifprint exiv2lib)          # link exiv2lib
Packit Service 21b5d1
Packit Service 21b5d1
$ cmake .                                          # generate the makefile
Packit Service 21b5d1
$ make                                             # build the code
Packit Service 21b5d1
$ ./exifprint                                      # test your executable
Packit Service 21b5d1
Usage: ./exifprint [ file | --version || --version-test ]
Packit Service 21b5d1
$
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
This [repository](https://github.com/piponazo/exiv2Consumer) shows an example of how to consume Exiv2 with CMake.
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.7 Using pkg-config to compile and link your code with Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
When exiv2 is installed, the file exiv2.pc used by pkg-config is installed in `${CMAKE_INSTALL_PREFIX}/lib/pkgconfig`  You will need to set the following in your environment:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
To compile and link using exiv2.pc, you usually add the following to your Makefile.
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
PKGCONFIG=pkg-config
Packit Service 21b5d1
CPPFLAGS := `pkg-config exiv2 --cflags`
Packit Service 21b5d1
LDFLAGS := `pkg-config exiv2 --libs`
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
If you are not using make, you can use pkg-config as follows:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
g++ -std=c++98 myprogram.cpp -o myprogram $(pkg-config exiv2 --libs --cflags)
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.8 Localisation
Packit Service 21b5d1
Packit Service 21b5d1
Localisation is supported on a UNIX-like platform:  Linux, MacOS-X, Cygwin and MinGW/msys2.  Localisation is not supported for Visual Studio builds.
Packit Service 21b5d1
Packit Service 21b5d1
To build localisation support, use the CMake option `-DEXIV2_ENABLE_NLS=ON`.  You must install the `gettext` package with your package manager or from source.  The `gettext` package is available from [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) and includes the library `libintl` and utilities to build localisation files.  If CMake produces error messages which mention libintl or gettext, you should verify that the package `gettext` has been correctly built and installed.
Packit Service 21b5d1
Packit Service 21b5d1
You must install the build to test localisation.  This ensures that the localisation message files can be found at run-time.  You cannot test localisation in the directory `build\bin`.
Packit Service 21b5d1
Packit Service 21b5d1
1) Running exiv2 in another language
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ env LANG=fr_FR exiv2    # env LANGUAGE=fr_FR exiv2 on Linux!
Packit Service 21b5d1
exiv2: Une action doit être spécifié
Packit Service 21b5d1
exiv2: Au moins un fichier est nécessaire
Packit Service 21b5d1
Utilisation : exiv2  [ options ] [ action ] fichier ...
Packit Service 21b5d1
Packit Service 21b5d1
Manipulation des métadonnées EXIF issues des images.
Packit Service 21b5d1
$
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
2) Adding additional languages to exiv2
Packit Service 21b5d1
Packit Service 21b5d1
To support a new language which we'll designate 'xy' for this discussion:
Packit Service 21b5d1
Packit Service 21b5d1
2.1) Generate a po file from the po template:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>
Packit Service 21b5d1
$ mkdir -p po/xy
Packit Service 21b5d1
$ msginit --input=po/exiv2.pot --locale=xy --output=po/xy.po
Packit Service 21b5d1
```
Packit Service 21b5d1
2.2) Edit/Translate the strings in po/xy.po
Packit Service 21b5d1
Packit Service 21b5d1
I edited the following:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
#: src/exiv2.cpp:237
Packit Service 21b5d1
msgid "Manipulate the Exif metadata of images.\n"
Packit Service 21b5d1
msgstr ""
Packit Service 21b5d1
```
Packit Service 21b5d1
to:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
#: src/exiv2.cpp:237
Packit Service 21b5d1
msgid "Manipulate the Exif metadata of images.\n"
Packit Service 21b5d1
msgstr "Manipulate image metadata.\n"
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
2.3) Generate the messages file:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ mkdir -p             po/xy/LC_MESSAGES
Packit Service 21b5d1
$ msgfmt --output-file=po/xy/LC_MESSAGES/exiv2.mo po/xy.po
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
2.4) Install and test your messages:
Packit Service 21b5d1
Packit Service 21b5d1
You have to install your messages to test them.  It's not possible to test a messages file by executing build/bin/exiv2.
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ sudo mkdir -p                          /usr/local/share/locale/xy/LC_MESSAGES
Packit Service 21b5d1
$ sudo cp -R  po/xy/LC_MESSAGES/exiv2.mo /usr/local/share/locale/xy/LC_MESSAGES
Packit Service 21b5d1
$ env LANG=xy exiv2                      # env LANGUAGE=xy on Linux!
Packit Service 21b5d1
exiv2: An action must be specified
Packit Service 21b5d1
exiv2: At least one file is required
Packit Service 21b5d1
Usage: exiv2 [ options ] [ action ] file ...
Packit Service 21b5d1
Packit Service 21b5d1
Manipulate image metadata.   <--------- Edited message!
Packit Service 21b5d1
$
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
2.5) Submitting your new language file for inclusion in future versions of Exiv2:
Packit Service 21b5d1
Packit Service 21b5d1
You may submit a PR which contains po/xy.po AND a modification to po/CMakeLists.txt
Packit Service 21b5d1
Packit Service 21b5d1
Or, open a new issue on https://github.com/exiv2/exiv2 and attach the file xy.po.zip which can be created as follows:
Packit Service 21b5d1
Packit Service 21b5d1
```
Packit Service 21b5d1
$ zip xy.po.zip po/xy.po
Packit Service 21b5d1
  adding: po/xy.po (deflated 78%)
Packit Service 21b5d1
ls -l xy.po.zip
Packit Service 21b5d1
-rw-r--r--+ 1 rmills  staff  130417 25 Jun 10:15 xy.po.zip
Packit Service 21b5d1
$
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.9 Building Exiv2 Documentation
Packit Service 21b5d1
Packit Service 21b5d1
Building documentation requires installing special tools.  You will probably prefer to
Packit Service 21b5d1
read the documentation on-line from the project website: https://exiv2.org
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
To build documentation, use the CMake option **`-DEXIV2_BUILD_DOC=On`**.
Packit Service 21b5d1
Additionally, you will require an additional build step to actually build the documentation.
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cmake ..options.. -DEXIV2_BUILD_DOC=ON
Packit Service 21b5d1
$ make doc
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
To build the documentation, you must install the following products:
Packit Service 21b5d1
Packit Service 21b5d1
| Product      | Availability |
Packit Service 21b5d1
|:------------ |:------------ |
Packit Service 21b5d1
| doxygen
graphviz
python
xsltproc
md5sum | [http://www.doxygen.org/](http://www.doxygen.org/)
[http://www.graphviz.org/](http://www.graphviz.org/)
[http://www.python.org/](http://www.python.org/)
[http://xmlsoft.org/XSLT/](http://xmlsoft.org/XSLT/)
[http://www.microbrew.org/tools/md5sha1sum/](http://www.microbrew.org/tools/md5sha1sum/) |
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.10 Building Exiv2 Packages
Packit Service 21b5d1
Packit Service 21b5d1
To enable the building of Exiv2 packages, use the CMake option `-DEXIV2_TEAM_PACKAGING=ON`.
Packit Service 21b5d1
Packit Service 21b5d1
You should not build Exiv2 Packages.  This feature is intended for use by Team Exiv2 to create Platform and Source Packages on the buildserver.
Packit Service 21b5d1
Packit Service 21b5d1
There are two types of Exiv2 packages which are generated by cpack from the cmake command-line.
Packit Service 21b5d1
Packit Service 21b5d1
1) Platform Package (header files, binary library and samples.  Some documentation and release notes)
Packit Service 21b5d1
Packit Service 21b5d1
Create and build exiv2 for your platform.
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ git clone https://github.com/exiv2/exiv2
Packit Service 21b5d1
$ mkdir -p exiv2/build
Packit Service 21b5d1
$ cd       exiv2/build
Packit Service 21b5d1
$ cmake .. -G "Unix Makefiles" -DEXIV2_TEAM_PACKAGING=On
Packit Service 21b5d1
...
Packit Service 21b5d1
-- Build files have been written to: .../build
Packit Service 21b5d1
$ cmake --build . --config Release
Packit Service 21b5d1
...
Packit Service 21b5d1
[100%] Built target addmoddel
Packit Service 21b5d1
$ make package
Packit Service 21b5d1
...
Packit Service 21b5d1
CPack: - package: /path/to/exiv2/build/exiv2-0.27.1-Linux.tar.gz generated.
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
2) Source Package
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ make package_source
Packit Service 21b5d1
Run CPack packaging tool for source...
Packit Service 21b5d1
...
Packit Service 21b5d1
CPack: - package: /path/to/exiv2/build/exiv2-0.27.1-Source.tar.gz generated.
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
You may prefer to run `$ cmake --build . --config Release --target package_source`
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.11 Debugging Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
1) Generating and installing a debug library
Packit Service 21b5d1
Packit Service 21b5d1
In general to generate a debug library, you should use the option *cmake* option `-DCMAKE_RELEASE_TYPE=Debug` and build in the usual way.
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>
Packit Service 21b5d1
$ mkdir build
Packit Service 21b5d1
$ cd build
Packit Service 21b5d1
$ cmake .. -G "Unix Makefiles" "-DCMAKE_BUILD_TYPE=Debug"
Packit Service 21b5d1
$ make
Packit Service 21b5d1
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
You must install the library to ensure that your code is linked to the debug library.
Packit Service 21b5d1
Packit Service 21b5d1
You can check that you have generated a debug build with the command:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ exiv2 -vVg debug
Packit Service 21b5d1
exiv2 0.27.1
Packit Service 21b5d1
debug=1
Packit Service 21b5d1
$
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
2) About preprocessor symbols `NDEBUG` and `EXIV2_DEBUG_MESSAGES`
Packit Service 21b5d1
Packit Service 21b5d1
Exiv2 respects the symbol `NDEBUG` which is set only for Release builds. There are sequences of code which are defined within:
Packit Service 21b5d1
Packit Service 21b5d1
```C++
Packit Service 21b5d1
#ifdef EXIV2_DEBUG_MESSAGES
Packit Service 21b5d1
....
Packit Service 21b5d1
#endif
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
Those blocks of code are not compiled unless you define `EXIV2_DEBUG_MESSAGES` by yourself. They are provided for additional debugging information. For example, if you are interested in additional output from webpimage.cpp, you can update your build as follows:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>
Packit Service 21b5d1
$ touch src/webpimage.cpp
Packit Service 21b5d1
$ make CXXFLAGS=-DEXIV2_DEBUG_MESSAGESDEBUG
Packit Service 21b5d1
$ bin/exiv2 ...
Packit Service 21b5d1
-- or --
Packit Service 21b5d1
$ sudo make install
Packit Service 21b5d1
$ exiv2     ...
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
If you are debugging library code, it is recommended that you use the exiv2 command-line as your test harness as Team Exiv2 is very familiar with this tool and able to give support.
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
3) Starting the debugger
Packit Service 21b5d1
Packit Service 21b5d1
This is platform specific.  On Linux:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ gdb exiv2
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
4) Using Debugger IDEs such as Xcode, CLion, Visual Studio, Eclipse or QtCreator
Packit Service 21b5d1
Packit Service 21b5d1
I have used all those IDEs to debug the Exiv2 library and applications.  All of them work.  You may find it takes initial effort, however I assure you that they all work well.
Packit Service 21b5d1
Packit Service 21b5d1
I personally use CLion which has excellent integration with CMake.  It will automatically add **`-DCMAKE_BUILD_TYPE=Debug`** to the cmake command.  It keeps build types in separate directories such as **`<exiv2dir>/cmake-build-debug`**.
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
5) cmake --build . options **`--config Release|Debug`** and **`--target install`**
Packit Service 21b5d1
Packit Service 21b5d1
Visual Studio and Xcode can build debug or release builds without using the option **`-DCMAKE_BUILD_TYPE`** because the generated project files can build multiple types.  The option **`--config Debug`** can be specified on the command-line to specify the build type.  Alternatively, if you prefer to build in the IDE, the UI provides options to select the configuration and target.
Packit Service 21b5d1
Packit Service 21b5d1
With the Unix Makefile generator, the targets can be listed:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ make help
Packit Service 21b5d1
The following are some of the valid targets for this Makefile:
Packit Service 21b5d1
... all (the default if no target is provided)
Packit Service 21b5d1
... clean
Packit Service 21b5d1
... depend
Packit Service 21b5d1
... install/local
Packit Service 21b5d1
.........
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.12 Building Exiv2 with **clang** and other build chains
Packit Service 21b5d1
Packit Service 21b5d1
1) On Linux
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>
Packit Service 21b5d1
$ rm -rf build ; mkdir build ; cd build
Packit Service 21b5d1
$ cmake .. -DCMAKE_C_COMPILER=$(which clang) -DCMAKE_CXX_COMPILER=$(which clang++)
Packit Service 21b5d1
$ cmake --build .
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
**_OR_**
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ export CC=$(which clang)
Packit Service 21b5d1
$ export CXX=$(which clang++)
Packit Service 21b5d1
$ cd <exiv2dir>
Packit Service 21b5d1
$ rm -rf build ; mkdir build ; cd build
Packit Service 21b5d1
$ cmake ..
Packit Service 21b5d1
$ cmake --build .
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
2) On MacOS-X
Packit Service 21b5d1
Packit Service 21b5d1
Apple provide clang with Xcode.  GCC has not been supported by Apple since 2013.  The _"normal unix build"_ uses Clang.
Packit Service 21b5d1
Packit Service 21b5d1
3) On Cygwin, MinGW/msys2, Windows (using clang-cl) and Visual Studio.
Packit Service 21b5d1
Packit Service 21b5d1
I have been unable to get clang to work on any of those platforms.
Packit Service 21b5d1
Packit Service 21b5d1
4) Cross Compiling
Packit Service 21b5d1
Packit Service 21b5d1
I've never succeeded in getting this to work.  I use different VMs for Linux 32 and 64 bit.  I've documented how to set up Cygwin and MinGW/msys2 for 64 and 32 bit builds in [README-CONAN](README-CONAN.md)
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 2.13 Building Exiv2 with ccache
Packit Service 21b5d1
Packit Service 21b5d1
To speed up compilation, the utility ccache can be installed to cache the output of the compiler.  This greatly speeds up the build when you frequently built code that has not been modified.
Packit Service 21b5d1
Packit Service 21b5d1
Installing and using ccache (and other similar utilities), is platform dependent.  On Ubuntu:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ sudo apt install --yes ccache
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
To build with ccache, use the cmake option **-DBUILD\_WITH\_CCACHE=On**
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>
Packit Service 21b5d1
$ mkdir build ; cd build ; cd build
Packit Service 21b5d1
$ cmake .. -G "Unix Makefiles" -DBUILD_WITH_CCACHE=On
Packit Service 21b5d1
$ make
Packit Service 21b5d1
# Build again to appreciate the performance gain
Packit Service 21b5d1
$ make clean
Packit Service 21b5d1
$ make
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
Due to the way in which ccache is installed in Fedora (and other Linux distros), ccache effectively replaces the compiler.  A default build or **-DBUILD\_WITH\_CCACHE=Off** is not effective and the environment variable CCACHE_DISABLE is required to disable ccache. [https://github.com/Exiv2/exiv2/issues/361](https://github.com/Exiv2/exiv2/issues/361)
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
## 3 License and Support
Packit Service 21b5d1
Packit Service 21b5d1
All project resources are accessible from the project website.
Packit Service 21b5d1
    https://github.com/Exiv2/exiv2
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 3.1 License
Packit Service 21b5d1
Packit Service 21b5d1
Copyright (C) 2004-2019 Exiv2 authors.
Packit Service 21b5d1
You should have received a copy of the file [COPYING](COPYING) which details the GPLv2 license.
Packit Service 21b5d1
Packit Service 21b5d1
Exiv2 is free software; you can redistribute it and/or modify
Packit Service 21b5d1
it under the terms of the GNU General Public License as published by
Packit Service 21b5d1
the Free Software Foundation; either version 2 of the License, or
Packit Service 21b5d1
(at your option) any later version.
Packit Service 21b5d1
Packit Service 21b5d1
Exiv2 program is distributed in the hope that it will be useful,
Packit Service 21b5d1
but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 21b5d1
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 21b5d1
GNU General Public License for more details.
Packit Service 21b5d1
Packit Service 21b5d1
You should have received a copy of the GNU General Public License along
Packit Service 21b5d1
with this program; if not, write to the Free Software Foundation, Inc.,
Packit Service 21b5d1
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 3.2 Support
Packit Service 21b5d1
For new bug reports and feature requests, please open an issue in Github.
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
## 4 Running the test suite
Packit Service 21b5d1
Packit Service 21b5d1
The test suite is a mix of bash and python scripts.  The python scripts are new to v0.27 and the bash scripts are being replaced as time permits.
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 4.1 Running tests on a UNIX-like system
Packit Service 21b5d1
Packit Service 21b5d1
You can run the suite directly from the build:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cmake .. -G "Unix Makefiles"
Packit Service 21b5d1
$ make
Packit Service 21b5d1
...
Packit Service 21b5d1
$ make tests
Packit Service 21b5d1
... lots of output ...
Packit Service 21b5d1
Summary report
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
You can run individual tests in the test directory using the environment variable EXIV2\_BINDIR to specify the location of the build artifacts.  For Cygwin and MinGW/msys builds, also set EXIV2_EXT=.exe
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
rmills@rmillsmbp-w7 ~/gnu/github/exiv2/exiv2/build $ cd ../test
Packit Service 21b5d1
rmills@rmillsmbp-w7 ~/gnu/github/exiv2/exiv2/test $ env EXIV2_BINDIR=${PWD}/../build/bin ./icc-test.sh
Packit Service 21b5d1
ICC jpg md5 webp md5 png md5 jpg md5
Packit Service 21b5d1
all testcases passed.
Packit Service 21b5d1
Packit Service 21b5d1
rmills@rmillsmbp-w7 ~/gnu/github/exiv2/exiv2/test $ env EXIV2_BINDIR=${PWD}/../build/bin make newtests
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 4.2 Running tests on Visual Studio builds
Packit Service 21b5d1
Packit Service 21b5d1
Use the bash interpreter for MinGW/msys2 to run the test suite.  It's essential to have a DOS Python3 interpreter on your path called `python3.exe`  The variables EXIV2\_BINDIR and EXIV2\_EXT enable the test suite to locate the MSVC build artifacts.
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>/build
Packit Service 21b5d1
$ cd ../test
Packit Service 21b5d1
$ PATH="/c/Python37:$PATH"
Packit Service 21b5d1
$ export EXIV2_EXT=.exe
Packit Service 21b5d1
$ export EXIV2_BINDIR=${PWD}/../build/bin
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
**Caution: ** The python3 interpreter must be for DOS and called python3.exe.  I copied `c:\Python37\python.exe c:\Python37\python3.exe`
Packit Service 21b5d1
Packit Service 21b5d1
Once you have modified the PATH and and exported EXIV2\_BINDIR and EXIV2\_EXT, you can execute the test suite as described for UNIX-like systems:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>/test
Packit Service 21b5d1
$ make test
Packit Service 21b5d1
$ make newtests
Packit Service 21b5d1
$ ./icc-test.sh
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 4.3 Unit tests
Packit Service 21b5d1
Packit Service 21b5d1
The code for the unit tests is in `<exiv2dir>/unitTests`
Packit Service 21b5d1
Packit Service 21b5d1
To build the unit tests, use the *cmake* option `-DEXIV2_BUILD_UNIT_TESTS=ON`.
Packit Service 21b5d1
Packit Service 21b5d1
To execute the unit tests:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ cd <exiv2dir>/build
Packit Service 21b5d1
$ bin/unit_tests
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575)
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
## 5 Platform Notes
Packit Service 21b5d1
Packit Service 21b5d1
There are many ways to set up and configure your platform.  The following notes are provided as a guide.
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 5.1 Linux
Packit Service 21b5d1
Packit Service 21b5d1
Update your system and install the build tools and dependencies (zlib, expat, gtest and others)
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ sudo apt --yes update
Packit Service 21b5d1
$ sudo apt install --yes build-essential git clang ccache python3 libxml2-utils cmake python3 libexpat1-dev libz-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libgtest-dev google-mock
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
Get the code from GitHub and build
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ mkdir -p ~/gnu/github/exiv2
Packit Service 21b5d1
$ cd ~/gnu/github/exiv2
Packit Service 21b5d1
$ git clone https://github.com/exiv2/exiv2
Packit Service 21b5d1
$ cd exiv2
Packit Service 21b5d1
$ mkdir build ; cd build ;
Packit Service 21b5d1
$ cmake .. -G "Unix Makefiles"
Packit Service 21b5d1
$ make
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 5.2 MacOS-X
Packit Service 21b5d1
Packit Service 21b5d1
You will need to install Xcode and the Xcode command-line tools to build on the Mac.
Packit Service 21b5d1
Packit Service 21b5d1
You should build and install libexpat and zlib.  You may use brew, macports, build from source, or use conan.
Packit Service 21b5d1
Packit Service 21b5d1
I recommend that you build and install CMake from source.
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 5.3 MinGW
Packit Service 21b5d1
Packit Service 21b5d1
We provide support for both 64bit and 32bit builds using MinGW/msys2. [https://www.msys2.org](https://www.msys2.org)
Packit Service 21b5d1
Packit Service 21b5d1
Support for MinGW/msys1.0 32 bit build was provided for Exiv2 v0.26.  MinGW/msys1.0 is not supported by Team Exiv2 for Exiv2 v0.27 and later.
Packit Service 21b5d1
Packit Service 21b5d1
There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575)
Packit Service 21b5d1
Packit Service 21b5d1
#### MinGW/msys2 64 bit
Packit Service 21b5d1
Install: [http://repo.msys2.org/distrib/x86\_64/msys2-x86\_64-20180531.exe](http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe)
Packit Service 21b5d1
Packit Service 21b5d1
I use the following batch file to start the MinGW/msys2 64 bit bash shell from the Dos Command Prompt (cmd.exe)
Packit Service 21b5d1
Packit Service 21b5d1
```bat
Packit Service 21b5d1
@echo off
Packit Service 21b5d1
setlocal
Packit Service 21b5d1
set "PS1=\! MSYS64:\u@\h:\w \$ "
Packit Service 21b5d1
set  PATH="/usr/local/bin/:/usr/bin:/mingw64/bin:/bin:/usr/sbin:/sbin"
Packit Service 21b5d1
set "HOME=c:\msys64\home\%USERNAME%"
Packit Service 21b5d1
if NOT EXIST %HOME% mkdir %HOME%
Packit Service 21b5d1
cd  %HOME%
Packit Service 21b5d1
c:\msys64\usr\bin\bash.exe -norc
Packit Service 21b5d1
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
#### MinGW/msys2 32 bit
Packit Service 21b5d1
Install: [http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe](http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe)
Packit Service 21b5d1
Packit Service 21b5d1
I use the following batch file to start the MinGW/msys2 32 bit bash shell from the Dos Command Prompt (cmd.exe)
Packit Service 21b5d1
Packit Service 21b5d1
```bat
Packit Service 21b5d1
@echo off
Packit Service 21b5d1
setlocal
Packit Service 21b5d1
set "PS1=\! MSYS32:\u@\h:\w \$ "
Packit Service 21b5d1
set  PATH="/usr/local/bin/:/usr/bin:/mingw32/bin:/bin:/usr/sbin:/sbin"
Packit Service 21b5d1
set "HOME=c:\msys32\home\%USERNAME%"
Packit Service 21b5d1
if NOT EXIST %HOME% mkdir %HOME%
Packit Service 21b5d1
cd  %HOME%
Packit Service 21b5d1
c:\msys32\usr\bin\bash.exe -norc
Packit Service 21b5d1
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
#### Install MinGW Dependencies
Packit Service 21b5d1
Packit Service 21b5d1
Install tools and dependencies:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ for i in base-devel git cmake coreutils python3 man gcc gdb make dos2unix diffutils zlib-devel libexpat-devel libiconv-devel gettext-devel; do (echo y|pacman -S $i); done
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
You can upgrade all installed packages on your system with the following command.  For me, this broke msys32 and I had to reinstall msys32 and all the dependencies.  Your experience may be different.
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ pacman -Syu
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
#### Download exiv2 from github and build
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ mkdir -p ~/gnu/github/exiv2
Packit Service 21b5d1
$ cd       ~/gnu/github/exiv2
Packit Service 21b5d1
$ git clone https://github.com/exiv2/exiv2
Packit Service 21b5d1
$ cd exiv2
Packit Service 21b5d1
$ mkdir build ; cd build ;
Packit Service 21b5d1
$ cmake .. -G "Unix Makefiles"
Packit Service 21b5d1
$ make
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
#### MinGW and Regex
Packit Service 21b5d1
Packit Service 21b5d1
The exiv2 command line program provides an option **`--grep`** to filter output.  The implementation requires the header file **`<regex.h>`** and supporting library to be available during the build.  When not available, the option **`--grep`** degrades to a substring match.  Because there are several versions of **`<regex.h>`** available on the MinGW platform, detection of regex is always disabled on this platform and uses substring match.  The following command reveals if regex is included in your build:
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ exiv2 -vVg regex
Packit Service 21b5d1
exiv2 0.27.1
Packit Service 21b5d1
have_regex=1
Packit Service 21b5d1
$
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 5.4 Cygwin
Packit Service 21b5d1
Packit Service 21b5d1
Download: [https://cygwin.com/install.html](https://cygwin.com/install.html) and run setup-x86_64.exe for 64 Bit Cygwin, or setup-x86.exe for 32 bit Cygwin.  I install into c:\\cygwin64 and c:\\cygwin32
Packit Service 21b5d1
Packit Service 21b5d1
You need:
Packit Service 21b5d1
make, cmake, gcc, gettext-devel pkg-config, dos2unix, zlib-devel, libexpat1-devel, git, python3-interpreter, libiconv, libxml2-utils, libncurses.
Packit Service 21b5d1
Packit Service 21b5d1
Download and build libiconv-1.15: [https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz](https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz)
Packit Service 21b5d1
Packit Service 21b5d1
There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575)
Packit Service 21b5d1
Packit Service 21b5d1
Download and build cmake from source because I can't get the cygwin installed cmake 3.6.2 to work.
Packit Service 21b5d1
To build cmake from source, you need libncurses. [https://cmake.org/download/](https://cmake.org/download/)
Packit Service 21b5d1
Packit Service 21b5d1
I use the following batch file "cygwin64.bat" to start the Cygwin/64 bit bash shell from the Dos Command Prompt (cmd.exe).
Packit Service 21b5d1
Packit Service 21b5d1
```bat
Packit Service 21b5d1
@echo off
Packit Service 21b5d1
setlocal
Packit Service 21b5d1
set "PATH=c:\cygwin64\usr\local\bin;c:\cygwin64\bin;c:\cygwin64\usr\bin;c:\cygwin64\usr\sbin;"
Packit Service 21b5d1
if NOT EXIST %HOME% mkdir %HOME%
Packit Service 21b5d1
set "HOME=c:\cygwin64\home\rmills"
Packit Service 21b5d1
cd  %HOME%
Packit Service 21b5d1
set "PS1=\! CYGWIN64:\u@\h:\w \$ "
Packit Service 21b5d1
bash.exe -norc
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 5.5 Microsoft Visual C++
Packit Service 21b5d1
Packit Service 21b5d1
We recommend that you use Conan to build Exiv2 using Microsoft Visual C++. Exiv2 v0.27 can be built with Visual Studio versions 2008 and later.  We actively support and build with Visual Studio 2015, 2017 and 2019.
Packit Service 21b5d1
Packit Service 21b5d1
As well as Microsoft Visual Studio, you will need to install CMake, Python3, and Conan.
Packit Service 21b5d1
Packit Service 21b5d1
1) Binary installers for CMake on Windows are availably from [https://cmake.org/download/](https://cmake.org/download/).
Packit Service 21b5d1
2) Binary installers for Python3 are available from [python.org](https://python.org)
Packit Service 21b5d1
3) Conan can be installed using python/pip.  Details in [README-CONAN.md](README-CONAN.md)
Packit Service 21b5d1
Packit Service 21b5d1
I use the following batch file to start cmd.exe.  I do this to reduce the complexity of the path which grows as various tools are installed on Windows.  The purpose of this script is to ensure a "stripped down path".
Packit Service 21b5d1
Packit Service 21b5d1
```bat
Packit Service 21b5d1
@echo off
Packit Service 21b5d1
setlocal
Packit Service 21b5d1
cd  %HOMEPATH%
Packit Service 21b5d1
set "PATH=C:\Python37\;C:\Python27\;C:\Python27\Scripts;C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;c:\Program Files\cmake\bin;"
Packit Service 21b5d1
cmd
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
### 5.6 Unix
Packit Service 21b5d1
Packit Service 21b5d1
Exiv2 can be built on many Unix and Linux distros.  With v0.27.2, we are starting to actively support the Unix Distributions NetBSD and FreeBSD.  We hope to add CI support for these platforms in v0.27.3.
Packit Service 21b5d1
Packit Service 21b5d1
I have provided notes here based on my experience with these platforms.   Feedback is welcome.
Packit Service 21b5d1
Packit Service 21b5d1
I am willing to support Exiv2 on other commercial Unix distributions such as AIX, HP-UX and OSF/1 provided you provide with an ssh account for your platform.  I will require super-user privileges to install software.
Packit Service 21b5d1
Packit Service 21b5d1
#### NetBSD
Packit Service 21b5d1
Packit Service 21b5d1
You can build exiv2 from source using the methods described for linux.  I built and installed exiv2 using "Pure CMake" and didn't require conan.
Packit Service 21b5d1
You will want to use the package manager `pkgsrc` to build/install:
Packit Service 21b5d1
Packit Service 21b5d1
1. gcc  (currently GCC 5.5.0)
Packit Service 21b5d1
2. python3
Packit Service 21b5d1
3. cmake
Packit Service 21b5d1
4. bash
Packit Service 21b5d1
5. sudo
Packit Service 21b5d1
6. chksum
Packit Service 21b5d1
7. gettext
Packit Service 21b5d1
Packit Service 21b5d1
I entered links into the file system `# ln -s /usr/pkg/bin/python37 /usr/local/bin/python3` and `# ln -s /usr/pkg/bin/bash /bin/bash`
Packit Service 21b5d1
It's important to ensure that `LD_LIBRARY_PATH` includes `/usr/local/lib` and `/usr/pkg/lib`.  It's important to ensure that PATH includes `/usr/local/bin`, `/usr/pkg/bin` and `/usr/pkg/sbin`.
Packit Service 21b5d1
Packit Service 21b5d1
#### FreeBSD
Packit Service 21b5d1
Packit Service 21b5d1
Clang is pre-installed as ``/usr/bin/{cc|c++}` as well has libz and expat.  FreeBSD uses pkg as the package manager which I used to install cmake and git.
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
$ su root
Packit Service 21b5d1
Password:
Packit Service 21b5d1
# pkg install cmake
Packit Service 21b5d1
# pkg install git
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
To run the Exiv2 test suite, I installed bash and python.  The test suite requires additional work as the platform `diff` command does not understand the option `--binary` and returns an error.  In consequence, the test harness returns lots of errors.  I hope to address this in v0.27.3.
Packit Service 21b5d1
Packit Service 21b5d1
Packit Service 21b5d1
```bash
Packit Service 21b5d1
# pkg install bash
Packit Service 21b5d1
# pkg install python
Packit Service 21b5d1
```
Packit Service 21b5d1
Packit Service 21b5d1
#### Solaris
Packit Service 21b5d1
Packit Service 21b5d1
Work in progress:  [https://github.com/Exiv2/exiv2/issues/902](https://github.com/Exiv2/exiv2/issues/902)
Packit Service 21b5d1
Packit Service 21b5d1
[TOC](#TOC)
Packit Service 21b5d1
Packit Service 21b5d1
Robin Mills
Packit Service 21b5d1
Packit Service 21b5d1
Revised: 2019-07-29