xref: /OK3568_Linux_fs/buildroot/docs/manual/adding-packages-qmake.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun// -*- mode:doc; -*-
2*4882a593Smuzhiyun// vim: set syntax=asciidoc:
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun=== Infrastructure for QMake-based packages
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun[[qmake-package-tutorial]]
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun==== +qmake-package+ tutorial
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunFirst, let's see how to write a +.mk+ file for a QMake-based package, with
11*4882a593Smuzhiyunan example :
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun------------------------
14*4882a593Smuzhiyun01: ################################################################################
15*4882a593Smuzhiyun02: #
16*4882a593Smuzhiyun03: # libfoo
17*4882a593Smuzhiyun04: #
18*4882a593Smuzhiyun05: ################################################################################
19*4882a593Smuzhiyun06:
20*4882a593Smuzhiyun07: LIBFOO_VERSION = 1.0
21*4882a593Smuzhiyun08: LIBFOO_SOURCE = libfoo-$(LIBFOO_VERSION).tar.gz
22*4882a593Smuzhiyun09: LIBFOO_SITE = http://www.foosoftware.org/download
23*4882a593Smuzhiyun10: LIBFOO_CONF_OPTS = QT_CONFIG+=bar QT_CONFIG-=baz
24*4882a593Smuzhiyun11: LIBFOO_DEPENDENCIES = bar
25*4882a593Smuzhiyun12:
26*4882a593Smuzhiyun13: $(eval $(qmake-package))
27*4882a593Smuzhiyun------------------------
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunOn line 7, we declare the version of the package.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunOn line 8 and 9, we declare the name of the tarball (xz-ed tarball
32*4882a593Smuzhiyunrecommended) and the location of the tarball on the Web. Buildroot
33*4882a593Smuzhiyunwill automatically download the tarball from this location.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunOn line 10, we tell Buildroot what options to enable for libfoo.
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunOn line 11, we tell Buildroot the dependencies of libfoo.
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunFinally, on line line 13, we invoke the +qmake-package+
40*4882a593Smuzhiyunmacro that generates all the Makefile rules that actually allows the
41*4882a593Smuzhiyunpackage to be built.
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun[[qmake-package-reference]]
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun==== +qmake-package+ reference
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunThe main macro of the QMake package infrastructure is +qmake-package+.
48*4882a593SmuzhiyunIt is similar to the +generic-package+ macro.
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunJust like the generic infrastructure, the QMake infrastructure works
51*4882a593Smuzhiyunby defining a number of variables before calling the +qmake-package+
52*4882a593Smuzhiyunmacro.
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunFirst, all the package metadata information variables that exist in
55*4882a593Smuzhiyunthe generic infrastructure also exist in the QMake infrastructure:
56*4882a593Smuzhiyun+LIBFOO_VERSION+, +LIBFOO_SOURCE+, +LIBFOO_PATCH+, +LIBFOO_SITE+,
57*4882a593Smuzhiyun+LIBFOO_SUBDIR+, +LIBFOO_DEPENDENCIES+, +LIBFOO_INSTALL_STAGING+,
58*4882a593Smuzhiyun+LIBFOO_INSTALL_TARGET+.
59*4882a593Smuzhiyun
60*4882a593SmuzhiyunAn additional variable, specific to the QMake infrastructure, can
61*4882a593Smuzhiyunalso be defined.
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun* +LIBFOO_CONF_ENV+, to specify additional environment variables to
64*4882a593Smuzhiyun  pass to the +qmake+ script for the configuration step. By default, empty.
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun* +LIBFOO_CONF_OPTS+, to specify additional options to pass to the
67*4882a593Smuzhiyun  +qmake+ script for the configuration step. By default, empty.
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun* +LIBFOO_MAKE_ENV+, to specify additional environment variables to the
70*4882a593Smuzhiyun  +make+ command during the build and install steps. By default, empty.
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun* +LIBFOO_MAKE_OPTS+, to specify additional targets to pass to the
73*4882a593Smuzhiyun  +make+ command during the build step. By default, empty.
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun* +LIBFOO_INSTALL_STAGING_OPTS+, to specify additional targets to pass
76*4882a593Smuzhiyun  to the +make+ command during the staging installation step. By default,
77*4882a593Smuzhiyun  +install+.
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun* +LIBFOO_INSTALL_TARGET_OPTS+, to specify additional targets to pass
80*4882a593Smuzhiyun  to the +make+ command during the target installation step. By default,
81*4882a593Smuzhiyun  +install+.
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun* +LIBFOO_SYNC_QT_HEADERS+, to run syncqt.pl before qmake. Some packages
84*4882a593Smuzhiyun  need this to have a properly populated include directory before
85*4882a593Smuzhiyun  running the build.
86