sanjay
sanjay

Reputation: 755

How do I create an 'install' package for a Qt application?

Generally to install a package on a linux-based operating system you use

./configure
make 
make install

How does this work? And how do I create a package that can be installed this way?

My application uses the Qt framework and I think I'm aiming for something like "MyPackage.tar.gz"

Upvotes: 5

Views: 4441

Answers (4)

artless-noise-bye-due2AI
artless-noise-bye-due2AI

Reputation: 22420

Newer versions of debhelper support qmake. A rules file like,

#!/usr/bin/make -f
%:
        dh $@ --buildsystem=qmake

Is all that is needed. You need,

bar.file = foo
bar.path = install/dir

INSTALLS += bar

Inside your projects 'pro' or qmake file. qmake will create install targets and the perl file /usr/share/perl5/Debian/Debhelper/Buildsystem/qmake.pm will get called and parse the qmake file. You need to create 'debian/' files, changelog, compat, control, copyright as well the rules file.

Upvotes: 0

spraff
spraff

Reputation: 33395

Qt is often used with CMake, which I highly recommend. One notable point is that it likes out-of-source-builds.

Your configure script could be

#!/bin/bash
(mkdir build; cd build; ccmake ..)

and the makefile could be

#!/bin/bash
(cd build; make)

Upvotes: 0

Neox
Neox

Reputation: 2004

You can create a debian package from your projects. As I understood you want to create a package intended for distibution so I would suggest creating a debian package from your project. Here is an introduction for Debian Packaging system. In the article they at some point describe how to create a "rules" file which is at the core of the build process. Here is a sample of it that I typically use for my Qt/KDE projects:

#!/usr/bin/make -f
#export DH_VERBOSE=1
# This is the debhelper compatability version to use.

#export DH_COMPAT=3
DESTDIR=$(CURDIR)/debian/project
TR_DIR=$(CURDIR)/debian/project/usr/share/qt4/translations

configure:
        qmake project.pro

clean:
        dh_testdir
        dh_testroot
        dh_clean

build:  configure
        dh_testdir
        lrelease translations/project_en.ts
        $(MAKE)

install: build
        mkdir -p $(TR_DIR)
        cp translations/project_en.qm $(TR_DIR)
        $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/project install
        dh_installdirs

binary-arch: build install
         dh_testdir
         dh_testroot
         dh_installmenu
         dh_link
         dh_strip
         dh_compress
         dh_fixperms
         dh_installdeb
         dh_shlibdeps
         dh_gencontrol
         dh_md5sums
         dh_builddeb

This is normally sufficent for small projects.

Upvotes: 3

Tatu Lahtela
Tatu Lahtela

Reputation: 4554

configure is usually part of GNU build system (autotools), which is not in use in a typical Qt project. qmake is used instead for build file generation and it internally handles most of the tasks configure does for non-qt projects.

The typical build install process for a Qt application is

qmake
make 
make install

You could create a simple ./configure script that calls qmake if you need the command names to be identical. You can also use autotools with Qt if you need it, see e.g. Qt Creator Instructions For Autotools

Upvotes: 2

Related Questions