Compiling Phi

From PhiWiki
Jump to: navigation, search

Phi(sketeer) is an open-source project which enables you to build your own dedicated distribution. Except the Artephis editor itself is currently proprietary (because of license issues with included 3rd-party code and icons) - this will hopefully change in the future with upcoming releases and depends also how the project is supported by the community. However the Artephis binary is prebuilt and included for Windows, Linux and Mac OS X. Beside this, all the Phi libraries, Server modules, the Phis server code, the Apache module, Amphibia browser and the Installer are freely available and open-source: which makes it simple to port for example the Phis server part to a new environment or operating system.

Prerequisites

Phi is based on the famous C++ toolkit Qt which is freely available at http://qt.digia.com. For compiling Phi you need at least Qt version 5.0.2. For obtaining the Phisketeer source code you need git freely available at http://git-scm.com/downloads.

Note: the following instructions for patching Qt are mainly for version 5.0.2. Later versions may have fixed some or all problems.

Unix / Linux

  • GCC >= 4.4.3 (support for C++11 is required)
  • development headers for libICU, Apache web server, CUPS (common unix printing system), GLIB, OpenSSL
  • perf, bison, perl, ... packages for successfully compiling Qt

Qt5 configuration used for the official Phisketeer distribution on Ubuntu (adapt it to your own needs):

$ ./configure -prefix /usr/local/qt/5.0.2 -no-linuxfb -no-directfb -no-opengl -no-eglfs \
   -no-dbus -no-pch -strip -cups -optimized-qmake -no-rpath -iconv -openssl -c++11 \
   -commercial -release -glib -qt-xcb -icu

Note: for building the QPA minimal platform plug-in (Qt 5.0.2) you need to patch the source (or font rendering into images will fail):

$ cp <path_to_phisketeer>/3rdparty/linux/qminimalintegration.* <path_to_qt>/qtbase/src/plugins/platforms/minimal/
$ cp <path_to_phisketeer>/3rdparty/linux/qgernicunixfontdatabase_p.h  <path_to_qt>/qtbase/src/platformsupport/fontdatabases/genericunix/

Hopefully this is fixed with the upcoming Qt5.1.0 release (summer 2013).

After configuring Qt5 run:

$ make -j4
$ sudo make install

Windows

Download and install the Qt5 standard distribution for Windows 32bit. For successfully compiling Phi you need:

  • A standard Qt5 binary distribution
  • Visual Studio 2010 or higher (needs the compiler only - the free available C++ compiler from MS should fit)
  • Git client - available here: http://msysgit.github.io

Mac OS X

For compiling Phi successfully you need at least Mac OS X Lion (10.7.4) or higher. Please check for recent Xcode updates. You also need to install the command line tools (available in the download area from Xcode). Phi is configured for using Apple's clang compiler.

Download Qt5 and comment out the following line (if using Qt 5.0.2) in qtbase/mkspecs/features/qt_module.prf in the Mac section (this is a bug and the Qt5 C++ headers will not be correctly installed):

# CONFIG -= qt_install_headers

The official Phi release uses the following Qt5 configure options:

$ ./configure -prefix /usr/local/qt/5.0.2 -commercial -release -process -force-debug-info -largefile -openssl \
     -no-rpath -optimized-qmake -nis -cups -iconv -strip -no-dbus -no-directfb -no-linuxfb -nomake demos \ 
     -nomake examples -system-proxies -qpa cocoa -c++11 -platform macx-clang-libc++ \ 
     -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

Compile and install Qt5:

$ make -j8
$ sudo make install

Getting the Phisketeer sources

Currently two Git servers are available for obtaining the Phi source code. Run:

$ git clone git://gitorious.org/phisketeer/phisketeer.git # Gitorious.org
   # or
$ git clone git://github.com/Phisketeer/phisketeer.git  # GitHub.com

This will create a phisketeer/ directory containing the Phi sources.

Configuration

Please consult the phisketeer/phi.pro file and phisketeer/scripts/phiconf.pri for some compiling information and configuration options for Phi.

Compiling

Unix / Linux / Mac OS X

Open a terminal and run (in the phisketeer root directory):

$ /usr/local/qt/5.0.2/bin/qmake  # your location of qmake
$ make

Windows

Run in a Visual Studio command window (or Git bash):

> C:\Qt\5.0.2\bin\qmake  # your location of qmake 
> nmake

This should successfully compile Phi if everything is setup correctly.

Creating distributions

For your convenience Phi comes along with some prepared packaging scripts for Linux, Windows and Mac OS X.

Linux

If you want to create a binary distribution package with a self extracting installer - run:

$ make distlinux

If you want a tar.gz ball only (packed with the needed binaries, libs and plug-ins) - run:

$ make targz

Windows

On Windows Phi uses the free Installer-Software Inno Setup which can be found here: http://www.jrsoftware.org.

Run:

> nmake distwin

to create a distwin directory where all the necessary files are copied. This also creates a Phis.iss Inno Setup file. With this file you can create an installer package running Inno Setup.

Mac OS X

Consult the scripts/distmac.sh script and enable the appropriate lines for productbuild to fit your needs at the end of the file.

Then run:

$ make distmac