Hacking:Building

From Seamly
Revision as of 09:06, 23 September 2016 by Dismine (talk | contribs)
Other languages:
  • English


Getting the sources

Main repository: https://bitbucket.org/dismine/valentina
Mirror on GitHub: https://github.com/dismine/Valentina

From the download section

This method recommended for newbies. Just download the Valentina's source code from the downloads section and extract it.

Use tab Tags if you want to get code for specific version.

Use tab Branches if you wan to get code for develop branch.

With mercurial

This is more advanced way getting Valentina's source code. Please, visit Hacking:Tools#Mercurial for more information.

Dependencies

Mac OS X

  • Xcode.
  • The last Qt version for OS X from the official website: Download Qt.
  • (optional) TortoiseHG.
  • (optional) Mercurial that shipped with TortoiseHG can't be reached outside. So, if you want nice tag hash number in dialog About App install mercurial independent for this.

Windows

  • The last Qt version for MinGW from the official website: Download Qt.
  • (optional) TortoiseHG.

Note. Valenina's source code can be compiled with Visual Studio, but without support creating an installer.

Linux

  • g++ (at least GCC 4.6 is needed and GCC 4.8 is recommended)
  • Qt 5.0.0 and higher required. Qt 5.2.1 and higher recommended.
  • (optional) ccache (on Linux) Recommended for speed up often re-compilations.

You can find all our scripts for creating packages in a folder <root_source_directory>/dist/.

Configuring and building

The installed toolchains have to match the one Qt was compiled with.

Build keys

Depend on your purposes You can build Valentina with different keys:

  • noTests - disable compiling tests. Use if you don't need tests and what to speed up compilation time.
  • noRunPath - disable adding Rpath attribute. Works only for Linux.
  • no_ccache - have sens only on Linux. Disable using ccache for speed up compilation. PCH will be used instead.
  • noDebugSymbols - By default for release mode debug symbols will be placed outside of binary file. We use them for debugging and sending crash reports on Windows. Have sens only for Linux/Windows with GCC.
  • debug - Compile the project in debug mode.

By default all keys are disabled.

Building from command line

Usual way to build sources is described below, however on Windows and Linux you have the opportunity to build packages. Mac OS X will get package automatically.

cd $SOURCE_DIRECTORY
qmake "CONFIG += noTests noRunPath no_ccache noDebugSymbols" Valentina.pro -r
make (or mingw32-make or nmake or jom, depending on your platform)

Note. In order to build and use Valentina on Windows, the PATH environment variable needs to be extended.

Building with Qt Creator

Some more advanced users may find using IDE more preferable choice. Please, read Hacking:Tools#Qt_Creator.

Note. Building with Qt Creator on Windows and Linux doesn't support creating packages.

Deploying

Mac OS X

All you need is to find Valentina in the build directory and move it to Applications folder.

Windows

Go to scripts folder and run make_install.bat script. It will run building and creating an installer. The script create folder build where in the end you will find your installer.

Note. For making installer you will need to install NSIS.

Linux

Debian package

  • Install tool
sudo apt-get install dh-make
  • Create directory deb_build
mkdir deb_build
  • Copy source directory to *deb_build*
  • Copy *debian/* directory from *dist/debian* to root source directory.
  • In root source directory with *debian/* directory run:

If you want sign package

dpkg-buildpackage -k<public_key> -rfakeroot

or

dpkg-buildpackage -rfakeroot

if not.

That's all. In directory deb_build you will find deb package.

Note. If your deb package broken and you can't delete him use these two commands. Run commands below as a root in Debian, preceded by sudo in Ubuntu :

mv /var/lib/dpkg/info/PAQUET.* /tmp/
dpkg --remove --force-remove-reinstreq PAQUET

For example if name of package was **valentina**:

mv /var/lib/dpkg/info/valentina.* /tmp/
dpkg --remove --force-remove-reinstreq valentina

Gentoo

For Gentoo we provide ebuild scripts. You can find them on download page.

Additionaly you can find templates for scripts in folder <root>/dist/ebuild.

Issues with build

If you have issues with build Valentina check if you satisfy all dependencies. If this not help, create new issue in the issues tracker or new topic in the mailing list. Add information about your system and full log of compilation. We also need information about what branch did you fail try to build.

Current known issue, and solution, on building with QtCreator 3.4.0 based on Qt 5.4.1 on Windows 8 64-bit with Avira AntiVirus Pro version 15.0.10.434 (as of June 11 2015): Build fails with 'file previously exists' errors when writing build files to destination directory. Problem is based on Avira scanning each file causing delay, Qt retries writing the file and generates the error. Other versions of Qt Creator and Avira may exhibit similar behavior. Set Avira Real-Time Protection to 'off' before building.

Also look at Hacking:Problems_and_solutions.