glfs/x/lib/qt.xml

247 lines
9.6 KiB
XML
Raw Normal View History

<sect1 id="qt" xreflabel="Qt-&qt-version;">
<?dbhtml filename="qt.html" ?>
<title>Qt-&qt-version;</title>
<sect2>
<title>Introduction to <application>Qt</application></title>
<para>The <application>Qt</application> package contains a
<application>C++</application> <acronym>GUI</acronym> library. This is useful
for creating graphical applications or executing graphical applications that
are dynamically linked to the <application>Qt</application> library. One of the
major users of <application>Qt</application> is <application>KDE</application>.</para>
<sect3><title>Package information</title>
<itemizedlist spacing='compact'>
<listitem><para>Download (HTTP): <ulink url="&qt-download-http;"/></para></listitem>
<listitem><para>Download (FTP): <ulink url="&qt-download-ftp;"/></para></listitem>
<listitem><para>MD5 Sum: &qt-md5sum;</para></listitem>
<listitem><para>Download size: &qt-size;</para></listitem>
<listitem><para>Estimated Disk space required: &qt-buildsize;</para></listitem>
<listitem><para>Estimated build time: &qt-time;</para></listitem></itemizedlist>
</sect3>
<sect3><title><application>Qt</application> dependencies</title>
<sect4><title>Required</title>
<para><xref linkend="x-installing"/></para>
</sect4>
<sect4><title>Recommended</title>
<para><xref linkend="libjpeg"/> and <xref linkend="libmng"/>.</para>
</sect4>
<sect4><title>Optional</title>
<para><xref linkend="nas"/>, <xref linkend="cups"/>, <xref linkend="mysql"/>,
<xref linkend="postgresql"/>, <ulink url="http://firebird.sourceforge.net/">Firebird</ulink>,
and <ulink url="http://www.unixodbc.org/">unixODBC</ulink>.</para>
</sect4>
</sect3>
</sect2>
<sect2>
<title>Installation of <application>Qt</application></title>
<para>There are several ways to install a complicated package such as <application>Qt</application>.
The files are not completely position independent. Installation procedures execute the
program <filename>pkg-config</filename> to determine the location of package executables, libraries,
headers, and other files. For <application>Qt</application>, <filename>pkg-config</filename> will
look for the file <filename>lib/pkgconfig/qt-mt.pc</filename> which must be modified if relocating the
package. This file is set up correctly by the build process.</para>
<para>The default installation places the files in <filename class='directory'>/usr/local/qt/</filename>.
Many commercial distributions place the files in the system's
<filename class='directory'>/usr</filename> hierarchy. The package can also be installed
in an arbitrary directory.</para>
<para>This section will demonstrate two different methods.</para>
<note><para>The build time for <application>Qt</application> is quite long. If you want to
save some time and don't want the tutorials and examples, change the first make line to:</para>
<para><userinput><command>make sub-tools</command></userinput></para>
</note>
<sect3>
<title>Method 1 - Installing in the <filename class='directory'>/usr</filename> hierarchy</title>
<para>The advantage of this method is that no updates to the <filename>/etc/ld.so.conf</filename>
or <filename>/etc/man.conf</filename> files are required. The package files
are distributed within several subdirectories of the <filename class='directory'>/usr</filename>
hierarchy. This is the method that most commercial distributions use.</para>
<screen><userinput><command>sed -i "s:cp -f:install:" mkspecs/linux-g++/qmake.conf &amp;&amp;
bash
export PATH=$PWD/bin:$PATH &amp;&amp;
export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH &amp;&amp;
./configure -prefix /usr -docdir /usr/share/doc/qt \
-headerdir /usr/include/qt -plugindir /usr/lib/qt/plugins \
-datadir /usr/share/qt -translationdir /usr/share/qt/translations \
-sysconfdir /etc/qt -qt-gif -system-zlib \
-no-exceptions -thread -plugin-imgfmt-png -system-libpng &amp;&amp;
find -type f -name Makefile | xargs sed -i "s@-Wl,-rpath,/usr/lib@@g" &amp;&amp;
make &amp;&amp;
make install &amp;&amp;
ln -sf libqt-mt.so /usr/lib/libqt.so &amp;&amp;
cp -r doc/man /usr/share &amp;&amp;
cp -r examples /usr/share/doc/qt &amp;&amp;
exit</command></userinput></screen>
</sect3>
<sect3>
<title>Method 2 - Installing in <filename class='directory'>/opt</filename></title>
<para>This is the method recommended by the <application>Qt</application> developers. It
has the advantage of keeping all the package files consolidated in a dedicated directory
hierarchy. By using this method, an update can be made without overwriting a previous
installation and users can easily revert to a previous version by changing one symbolic
link.</para>
<para>The <application>Qt</application> developers use a default location of
<filename class='directory'>/usr/local/qt/</filename>, however this procedure puts the files
in <filename class='directory'>/opt/qt-&qt-version;/</filename> and then creates a
symbolic link to <filename>/opt/qt/</filename>.</para>
<screen><userinput><command>bash
export QTDIR=$PWD &amp;&amp;
export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH &amp;&amp;
export PATH=$PWD/bin:$PATH &amp;&amp;
./configure -prefix /opt/qt-&qt-version; -qt-gif -system-libpng \
&nbsp;&nbsp;&nbsp;-system-libmng -system-zlib -system-libjpeg -no-exceptions \
&nbsp;&nbsp;&nbsp;-thread -plugin-imgfmt-png &amp;&amp;
make &amp;&amp;
make install &amp;&amp;
ln -sfn qt-&qt-version; /opt/qt &amp;&amp;
ln -s libqt-mt.so /opt/qt/lib/libqt.so &amp;&amp;
cp -r doc/man /opt/qt/doc &amp;&amp;
cp -r examples /opt/qt/doc
exit</command></userinput></screen>
<sect4>
<title>Configuration</title>
<para>For Method 2 only, update the <filename>/etc/ld.so.conf</filename> and
<filename>/etc/man.conf</filename> files.</para>
<screen><userinput><command>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; "EOF"
# Begin qt addition to /etc/ld.so.conf
/opt/qt/lib
# End qt addition
EOF
ldconfig
cat &gt;&gt; /etc/man.conf &lt;&lt; "EOF"
# Begin qt addition to man.conf
MANPATH /opt/qt/doc/man
# End qt addition to man.conf
EOF</command></userinput></screen>
<para>Also, the <envar>QTDIR</envar> environment variable needs to be set when
building packages that depend on Qt. Add the following to the
<filename>.bash_profile</filename> initialization script for each user that
builds packages using the <application>Qt</application> libraries.
Alternatively, the variable can be set in the system wide
<filename>/etc/profile</filename> file.</para>
<screen><userinput>export QTDIR=/opt/qt</userinput></screen>
</sect4>
</sect3>
</sect2>
<sect2>
<title>Command explanations</title>
<para><command>sed -i "s:cp -f:install:" mkspecs/linux-g++/qmake.conf</command>:
<command>install</command> is safer than <command>cp</command> when
libraries are in use.</para>
<para><command>bash</command>: This command enters a sub-shell to isolate
environment changes.</para>
<para><command>export QTDIR=$PWD</command>: This command
defines where the root of the Qt directory is located.</para>
<para><command>export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH</command>: This command
allows the not yet installed qt libraries to be used by the not yet installed qt programs.</para>
<para><command>export PATH=$PWD/bin:$PATH</command>: This command
allows the build process to find supporting executables.</para>
<para><parameter>-qt-gif</parameter>: This switch adds support for gif
files to the libraries.</para>
<para><parameter>-system-zlib -system-libpng</parameter>: This switch
forces the build instructions to use the shared libraries that are on your system
instead of creating a custom set of support libraries for these
functions.</para>
<para><parameter>-no-exceptions</parameter>: This switch disables
the exceptions coding generated by the <application>C++</application> compiler.</para>
<para><parameter>-thread</parameter>: This switch adds
support for multi-threading.</para>
<para><command>find -type f -name Makefile | xargs sed -i
"s@-Wl,-rpath,/usr/lib@@g"</command>: This command removes hardcoded run-time
paths. Otherwise, <command>uic</command> always tries to run with Qt libraries
in <filename>/usr/lib</filename>.</para>
<para><command>ln -s libqt-mt.so /usr/lib/libqt.so</command>: This
command allows configure scripts
to find a working <application>Qt</application> installation.</para>
<para><command>cp -r doc/man /usr/share (or /opt/qt/doc)</command>: This command
installs the man pages which are missed by <command>make install</command>.</para>
<para><command>cp -r examples /usr/share/doc/qt (or /opt/qt/doc)</command>: This command
installs the examples which are missed by <command>make install</command>.</para>
<para><command>exit</command>: This command returns to the parent shell
and eliminates environment variables set earlier.</para>
</sect2>
<sect2>
<title>Configuring <application>Qt</application></title>
<sect3><title>Configuration Information</title>
<para>As with most libraries, there is no explicit configuration to do. After
updating <filename>/etc/ld.so.conf</filename> as explained above, run
<command>/sbin/ldconfig</command> so that <command>ldd</command> can find the
shared libraries.</para>
</sect3>
</sect2>
<sect2>
<title>Contents</title>
<para>The <application>Qt</application>/<application>X11</application>
library contains <acronym>API</acronym>s necessary to use
programs based on the Qt <acronym>GUI</acronym> toolkit.</para>
<para>The <application>Qt</application> package contains
<command>assistant</command>,
<command>designer</command>,
<command>linguist</command>,
<command>lrelease</command>,
<command>lupdate</command>,
<command>moc</command>,
<command>qm2ts</command>,
<command>qmake</command>,
<command>qtconfig</command>,
<command>uic</command>, and the
<filename class="libraryfile">libqt-mt</filename> and
<filename class="libraryfile">libqui</filename> libraries.</para>
</sect2>
</sect1>