
SIP SIMPLE SDK installation on Microsoft Windows
------------------------------------------------

Home page: http://sipsimpleclient.org

This document describes the installation procedure on Microsoft Windows
operating systems. Supported versions are Windows XP or higher.


Step 1. Prerequisites
---------------------

The building process is designed to work with the MSYS2 environment and the
MinGW-w64 compiler toolchain.  Other approaches might work but they are not
tested nor supported.

MSYS2: MSYS2 is a minimal Unix-like environment for Windows.  It includes a
port of the 'pacman' package manager (ported from Arch Linux) and a pretty
extensive collection of packages which can be easily installed.  It contains
packages for the MinGW-w64 toolchain, for 32 and 64 bit architectures.

MinGW-w64: MinGW is a minimal compilation toolchain for Windows.  It
contains GCC and allows for compilation of native applications for Windows. 
The original MinGW project (available at http://mingw.org, henceforth
referred to as 'MinGW32') didn't support 64 bit Windows so the MinGW-w64
project was created.  It contains support for both 32 and 64 bit
architectures and generally it's better maintained than MinGW32.


Step 1.1. Installing MSYS2 and MinGW-w64
----------------------------------------

The following instructions will guide you through the installation of a MSYS2 and MinGW-w64.

* Go to http://msys2.github.io and download the MSYS2 installer
* Run it and install it on C:\msys2 (or any other path, but note it has to be
  ASCII only and with no spaces! The no spaces restriction also applies to the
  paths of the packages that will be built during the installation)
* Upgrade the system packages by following the instructions from:
  http://msys2.github.io

Launch MSYS MINGW64

* Install the compiler toolchain and assorted tools:
  pacman -S mingw-w64-x86_64-toolchain


Step 1.2. Installing Python-PIP
-------------------------------

The Python binaries that are available for download on Python's official
website are compiled with Visual Studio, and if we use MinGW to compile
libraries which are then used by Python modules we are at risk because the
resulting application would load 2 different C runtimes.  So you should
remove python3 if it is installed in Windows.

* Install pip/setuptools: pacman -S mingw-w64-x86_64-python3-pip


Step 2. Install dependencies
----------------------------

See Dependencies.txt for detailed description of the required libraries and
their minimum version number.

* Install required dependencies with pacman:

  pacman -S mingw-w64-x86_64-gnutls mingw-w64-x86_64-python3-lxml \
  mingw-w64-x86_64-ffmpeg mingw-w64-x86_64-sqlite3 msys2-w32api-headers \
  mingw-w64-x86_64-gmp mingw-w64-x86_64-mpc mingw-w64-x86_64-mpfr

* Install the Python package dependencies:

  pip3 install cython==0.29.37 dnspython twisted python-dateutil greenlet


Step 2.1. Install python3-application, python3-gnults and python3-otr
---------------------------------------------------------------------

* Install git:
  pacman -S git

* Install python3-application

  pip3 install git+https://github.com/AGProjects/python3-application.git

* Install python3-gnutls:

  pacman -S mingw-w64-x86_64-python-pyopenssl
  pip install git+https://github.com/AGProjects/python3-gnutls.git --no-build-isolation

* Install cryptography:

  pacman -S --overwrite '*' mingw-w64-x86_64-python-setuptools-rust patch

  wget https://mirror.msys2.org/mingw/sources/mingw-w64-python-cryptography-38.0.4-1.src.tar.zst

  Extract this and cd into the dir:
  tar --zstd -xvf ./mingw-w64-python-cryptography-38.0.4-1.src.tar.zst
  cd mingw-w64-python-cryptography
  makepkg-mingw -cfiL --nocheck --nosign

* Install gmpy2:

  pacman -S mingw-w64-x86_64-python-gmpy2

* Install python3-otr:

  pip install git+https://github.com/AGProjects/python3-otr.git --no-build-isolation


Step 2.2. Build and install some extra packages
-----------------------------------------------

mingw-w64-intsafe-headers

* Get the package code: darcs get http://devel.ag-projects.com/repositories/windows/mingw-w64-intsafe-headers
* Enter the directory and build+install the package: cd mingw-w64-intsafe-headers && makepkg-mingw -cfiL --nocheck --nosign
* Install will probably fail, so install with pacman -U --overwrite '*' ./mingw-w64-intsafe-headers-1.1.0-1-any.pkg.tar.zst

mingw-w64-dshow-baseclasses

* Get the package code: darcs get http://devel.ag-projects.com/repositories/windows/mingw-w64-dshow-baseclasses
* Enter the directory and build+install the package: cd mingw-w64-dshow-baseclasses && makepkg-mingw -cfiL --nocheck --nosign


Step 3. Install SIP SIMPLE client SDK
-------------------------------------

The SDK consists of four parts:

 1. python-eventlib
 2. XCAP library
 3. MSRP library
 4. SIP SIMPLE library itself

Make sure that the path where you download the software below does not
contain any space in its name.

# Eventlib
  pip install git+https://github.com/AGProjects/python3-eventlib.git --no-build-isolation

# XCAP library
  pip install git+https://github.com/AGProjects/python3-xcaplib.git --no-build-isolation

# MSRP library
  pip install git+https://github.com/AGProjects/python3-msrplib.git --no-build-isolation

# SIPSimple SDK

  git clone https://github.com/AGProjects/python3-sipsimple.git

  cd python3-sipsimple

  ./get_dependencies.sh

  pip install . --no-build-isolation

