<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;

  <!-- Change for new minor releases !!! -->

  <!ENTITY qt5-major "5.4">
  <!ENTITY qt5-url   "http://download.qt-project.org/official_releases/qt/&qt5-major;/&qt5-version;/single">

  <!ENTITY qt5-download-http "&qt5-url;/qt-everywhere-opensource-src-&qt5-version;.tar.xz">
  <!ENTITY qt5-download-ftp  " ">
  <!ENTITY qt5-md5sum        "21843b00ecde8956217faab391bc007b">
  <!ENTITY qt5-size          "279 MB">
  <!ENTITY qt5-buildsize     "6.9 GB (266 MB installed)">
  <!ENTITY qt5-time          "27 SBU (parallelism=4, without Qt Web Engine), 138 SBU (parallelism=1, with Qt Web Engine)">
]>

<sect1 id="qt5" xreflabel="Qt-&qt5-version;">
  <?dbhtml filename="qt5.html" ?>

  <sect1info>
    <othername>$LastChangedBy: bdubbs $</othername>
    <date>$Date: 2015-03-02 17:33:58 -0500 (Mon, 02 Mar 2015) $</date>
  </sect1info>

  <title>Qt-&qt5-version;</title>

  <indexterm zone="qt5">
    <primary sortas="a-Qt">Qt</primary>
  </indexterm>

  <sect2 role="package">
    <title>Introduction to Qt5</title>

    <para>
      <application>Qt5</application> is a cross-platform application
      framework that is widely used for developing application software
      with a graphical user interface (GUI) (in which cases
      <application>Qt5</application> is classified as a widget toolkit), and
      also used for developing non-GUI programs such as command-line tools
      and consoles for servers. 
    </para>

    &lfs77_checked;

    <bridgehead renderas="sect3">Package Information</bridgehead>
    <itemizedlist spacing="compact">
      <listitem>
        <para>
          Download (HTTP): <ulink url="&qt5-download-http;"/>
        </para>
      </listitem>
      <listitem>
        <para>
          Download (FTP): <ulink url="&qt5-download-ftp;"/>
        </para>
      </listitem>
      <listitem>
        <para>
          Download MD5 sum: &qt5-md5sum;
        </para>
      </listitem>
      <listitem>
        <para>
          Download size: &qt5-size;
        </para>
      </listitem>
      <listitem>
        <para>
          Estimated disk space required: &qt5-buildsize;
        </para>
      </listitem>
      <listitem>
        <para>
          Estimated build time: &qt5-time;
        </para>
      </listitem>
    </itemizedlist>

    <bridgehead renderas="sect3">Qt5 Dependencies</bridgehead>

    <bridgehead renderas="sect4">Required</bridgehead>
    <para role="required">
      <xref linkend="xorg7-lib"/>
    </para>

    <bridgehead renderas="sect4">Recommended</bridgehead>
    <para role="recommended">
      <xref linkend="alsa-lib"/>,
      <xref linkend="cacerts"/>,
      <xref linkend="cups"/>,
      <xref linkend="dbus"/> (required for QtWebKit),
      <xref linkend="glib2"/>,
      <xref linkend="gst-plugins-base"/>,
      <xref linkend="icu"/> (required for QtWebKit),
      <xref linkend="jasper"/>,
      <xref linkend="libjpeg"/>,
      <xref linkend="libmng"/>,
      <xref linkend="libpng"/>,
      <xref linkend="libtiff"/>,
      <xref linkend="libwebp"/>,
      <xref linkend="mesalib"/>,
      <xref linkend="mtdev"/>,
      <xref linkend="openssl"/>,
      <xref linkend="pcre"/>,
      <xref linkend="sqlite"/>,
      <xref linkend="ruby"/> (required for QtWebKit),
      <xref linkend="xcb-util-image"/>,
      <xref linkend="xcb-util-keysyms"/>,
      <xref linkend="xcb-util-renderutil"/>, and
      <xref linkend="xcb-util-wm"/>
    </para>

    <bridgehead renderas="sect4">Optional</bridgehead>
    <para role="optional">
      <xref linkend="geoclue"/>,
      <xref linkend="gst10-plugins-base"/> (QtWebKit HTML5 Video Support),
      <xref linkend="gtk2"/> (GTK+ Theme Support),
      <xref linkend="harfbuzz"/>, <!-- Doesn't have all the features that the included one has. -->
      <ulink url="https://code.google.com/p/ibus/">IBus</ulink>,
      <ulink url="http://xkbcommon.org/">libxkbcommon</ulink>,
      <xref linkend="mariadb"/> or <ulink url="http://www.mysql.com/">MySQL</ulink>,
      <xref linkend="postgresql"/>,
      <xref linkend="pulseaudio"/>, and 
      <xref linkend="unixodbc"/>
    </para>

    <para condition="html" role="usernotes">User Notes:
      <ulink url="&blfs-wiki;/qt5"/>
    </para>
  </sect2>

   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 
               href="../../xincludes/qt-alternatives.xml"/>

  <sect2 role="installation">
    <title>Installation of Qt5</title>

    <caution>
      <para>
        If you did not install some of the recommended dependencies, examine
        <command>./configure --help</command> output to check how to disable
        them or use internal versions bundled in the source tarball.
      </para>
    </caution>

    <warning>
      <para>
        If <application>Qt5</application> is being reinstalled into the
        same directory as an existing instance, run the commands done by
        <systemitem class="username">root</systemitem>, such as
        <command>make install</command>, from a console or non-Qt5 based
        window manager. It overwrites <application>Qt5</application>
        libraries that should not be in use during the install process.
      </para>
    </warning>

<!-- ==== Method 1 ====== -->
    <bridgehead renderas="sect3">Method 1: Installing in /usr</bridgehead>

    <para>
      Install <application>Qt5</application> by running the
      following commands:
    </para>

    <!-- This is rather a bad idea. Most apps that I've seen using Qt5 look for -qt5
         suffixed programs.  On the other hand, the developer is used to running
         qmake, linguist, etc from the command line.  

    <note>
      <para>
        If <emphasis>not</emphasis> also installing <application>Qt4</application>
        into the /usr directory, change the entry for -bindir below to /usr/bin.
      </para>
    </note> -->

<screen><userinput>export QT5LINK=/usr

./configure -prefix         /usr               \
            -sysconfdir     /etc/xdg           \
            -bindir         /usr/bin           \
            -headerdir      /usr/include/qt5   \
            -archdatadir    /usr/lib/qt5       \
            -datadir        /usr/share/qt5     \
            -docdir         /usr/share/doc/qt5 \
            -translationdir /usr/share/qt5/translations \
            -examplesdir    /usr/share/doc/qt5/examples \
            -confirm-license   \
            -opensource        \
            -dbus-linked       \
            -openssl-linked    \<!--
            -system-harfbuzz   \-->
            -system-sqlite     \
            -no-nis            \
            -skip qtwebengine  \
            -nomake examples   \
            -optimized-qmake   &amp;&amp;
make</userinput></screen>

    <para>
      This package does not come with a test suite.
    </para>

    <para>
      Remove references to the build directory from the
      <filename class="extension">.pc</filename> files by running
      the following command:
    </para>

<screen><userinput>find . -name "*.pc" -exec perl -pi -e "s, -L$PWD/?\S+,,g" {} \;</userinput></screen>

    <para>
      Now, as the <systemitem class="username">root</systemitem> user:
    </para>

<screen role="root"><userinput>make install</userinput></screen>

    <para>
      Remove references to the build directory from installed files by
      running the following commands as the
      <systemitem class="username">root</systemitem> user:
    </para>

<screen role="root"><userinput>sed -e "s:$PWD/qtbase:/usr/lib/qt5:g" \
    -i /usr/lib/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri &amp;&amp;

find /usr/lib/lib{qgsttools_p,Qt5*}.prl -exec sed -i -r \
     '/^QMAKE_PRL_BUILD_DIR/d;s/(QMAKE_PRL_LIBS =).*/\1/' {} \;</userinput></screen>

<!-- ==== Method 2 ====== -->

  <bridgehead renderas="sect3">Method 2: Installing in /opt/qt-&qt5-version;</bridgehead>

  <para>
        This section provides instructions for installing Qt5 in the
        <filename class="directory">/opt</filename> directory.
   </para>

<screen><userinput>export QT5DIR=/opt/qt-&qt5-version; &amp;&amp;
export QT5LINK=/opt/qt5 &amp;&amp;

./configure -prefix     $QT5DIR  \
            -sysconfdir /etc/xdg \
            -confirm-license     \
            -opensource          \
            -dbus-linked         \
            -openssl-linked      \<!--
            -system-harfbuzz     \-->
            -system-sqlite       \
            -no-nis              \
            -nomake examples     \
            -skip qtwebengine    \
            -optimized-qmake     &amp;&amp;
make</userinput></screen>

    <para>
      Now, as the <systemitem class="username">root</systemitem> user:
    </para>

<screen role="root"><userinput>make install &amp;&amp;
ln -svfn $QT5DIR /opt/qt5</userinput></screen>

    <para>
      Remove references to the build directory from installed files by
      running the following commands as the
      <systemitem class="username">root</systemitem> user:
    </para>

<screen role="root"><userinput>find $QT5DIR -name qt_lib_bootstrap_private.pri \
   -exec sed -i -e "s:$PWD/qtbase:/$QT5DIR/lib/:g" {} \; &amp;&amp;

find $QT5DIR -name \*.prl \
   -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;</userinput></screen>

<!-- This is useful for packages looking explicitly for Qt apps with -qt5 suffix.

    <para>
      Symlink the <application>Qt5</application> executables into
      <filename class="directory">/usr/bin</filename> by running the
      following commands as the
      <systemitem class="username">root</systemitem> user:
    </para>

<screen role="root"><userinput>ln -svf $QT5DIR /opt/qt5 &amp;&amp;

for file in /opt/qt5/bin/*; do
  ln -sfv $file /usr/bin/$(basename $file)-qt5
done</userinput></screen> -->

<!-- ==== Common  ====== -->
    <bridgehead renderas="sect3">Continuing for Both Methods</bridgehead>

    <para>
      For all methods, install images and create the menu entries
      for installed applications.  Be sure that the <envar>QT5LINK</envar>
      variable is defined in root's environment and
      as the <systemitem class="username">root</systemitem> user:
    </para>

<screen role="root"><userinput>install -v -dm755 /usr/share/pixmaps/                  &amp;&amp;

install -v -Dm644 qttools/src/assistant/assistant/images/assistant-128.png \
                  /usr/share/pixmaps/assistant-qt5.png &amp;&amp;

install -v -Dm644 qttools/src/designer/src/designer/images/designer.png \
                  /usr/share/pixmaps/designer-qt5.png  &amp;&amp;

install -v -Dm644 qttools/src/linguist/linguist/images/icons/linguist-128-32.png \
                  /usr/share/pixmaps/linguist-qt5.png  &amp;&amp;

install -v -Dm644 qttools/src/qdbus/qdbusviewer/images/qdbusviewer-128.png \
                  /usr/share/pixmaps/qdbusviewer-qt5.png &amp;&amp;

install -dm755 /usr/share/applications &amp;&amp;

cat &gt; /usr/share/applications/assistant-qt5.desktop &lt;&lt; EOF
<literal>[Desktop Entry]
Name=Qt5 Assistant 
Comment=Shows Qt5 documentation and examples
Exec=$QT5LINK/bin/assistant
Icon=assistant-qt5.png
Terminal=false
Encoding=UTF-8
Type=Application
Categories=Qt;Development;Documentation;</literal>
EOF

cat &gt; /usr/share/applications/designer-qt5.desktop &lt;&lt; EOF
<literal>[Desktop Entry]
Name=Qt5 Designer
GenericName=Interface Designer
Comment=Design GUIs for Qt5 applications
Exec=$QT5LINK/bin/designer
Icon=designer-qt5.png
MimeType=application/x-designer;
Terminal=false
Encoding=UTF-8
Type=Application
Categories=Qt;Development;</literal>
EOF

cat &gt; /usr/share/applications/linguist-qt5.desktop &lt;&lt; EOF
<literal>[Desktop Entry]
Name=Qt5 Linguist
Comment=Add translations to Qt5 applications
Exec=$QT5LINK/bin/linguist
Icon=linguist-qt5.png
MimeType=text/vnd.trolltech.linguist;application/x-linguist;
Terminal=false
Encoding=UTF-8
Type=Application
Categories=Qt;Development;</literal>
EOF

cat &gt; /usr/share/applications/qdbusviewer-qt5.desktop &lt;&lt; EOF
<literal>[Desktop Entry]
Name=Qt5 QDbusViewer 
GenericName=D-Bus Debugger
Comment=Debug D-Bus applications
Exec=$QT5LINK/bin/qdbusviewer
Icon=qdbusviewer-qt5.png
Terminal=false
Encoding=UTF-8
Type=Application
Categories=Qt;Development;Debugger;</literal>
EOF</userinput></screen>

  </sect2>

  <sect2 role="commands">
    <title>Command Explanations</title>

    <para>
      <parameter>-confirm-license</parameter>: Accept license
      without prompting user during configuration.
    </para>

    <para>
      <parameter>-opensource</parameter>: Install the opensource
      version of <application>Qt</application>.
    </para>

    <para>
      <parameter>-release</parameter>: This switch disables
      building with debugging symbols.
    </para>

    <para>
      <parameter>-nomake examples</parameter>: This switch
      disables building of the example programs included
      in the source tarball. Remove it if you want to build
      them.
    </para>

    <para>
      <parameter>-system-sqlite</parameter>: This switch enables use
      of the system version of <application>SQLite</application>.
    </para>

    <para>
      <parameter>-no-nis</parameter>: This switch disables support
      for Network Information Service (NIS) which has been
      removed from recent versions of <application>Glibc</application>.
    </para>

    <para>
      <parameter>-dbus-linked -openssl-linked</parameter>: These
      switches enable explicit linking of the
      <application>D-Bus</application> and
      <application>OpenSSL</application> libraries into
      <application>Qt5</application> libraries instead of
      <command>dlopen()</command>-ing them.
    </para>

    <para>
      <parameter>-skip qtwebengine</parameter>: This switch disables
      building the Qt Web Engine.  It is not presently used by
      any applications.  If this option is removed, fix a build
      problem with:

<screen><userinput>sed -i '$ a !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0' \
       qtwebengine/src/core/config/desktop_linux.pri</userinput></screen>
    </para>

    <para>
      <parameter>-optimized-qmake</parameter>: This switch enables
      building of the optimized <command>qmake</command> program.
    </para>

    <para>
      <option>-system-harfbuzz</option>: This switch enables use
      of the system version of <application>Harfbuzz</application>
      which fixes some font rendering issues in
      <application>Qt5</application> applications but doesn't have all the
      features that the included one has.
    </para>

  </sect2>

  <sect2 role="configuration">
    <title>Configuring Qt5</title>

    <sect3 id="qt5-config">
      <title>Configuration Information</title>

      <para>
        Create the menu entries for installed applications by running the
        following commands <systemitem class="username">root</systemitem>
        user:
      </para>

      <para>
        If you installed <application>Qt5</application> in
        <filename class="directory">/usr</filename>, create an
        environment variable needed by certain packages.
        As the <systemitem class="username">root</systemitem> user:
      </para>

<screen role="root"><userinput>cat &gt; /etc/profile.d/qt5.sh &lt;&lt; EOF
<literal># Begin /etc/profile.d/qt5.sh

QT5DIR=/usr
export QT5DIR

# End /etc/profile.d/qt5.sh</literal>
EOF</userinput></screen>

      <para>
        If you installed <application>Qt5</application> in a location other
        than <filename class="directory">/usr</filename>, you need to update the
        following configuration files so that <application>Qt5</application> is
        correctly found by other packages and system processes.
      </para>

      <para>
        As the <systemitem class="username">root</systemitem> user, update
        the <filename>/etc/ld.so.conf</filename> file and the dynamic linker's
        run-time cache file:
      </para>

<screen role="root"><userinput>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; EOF
<literal># Begin Qt addition

/opt/qt5/lib

# End Qt addition</literal>
EOF

ldconfig</userinput></screen>

      <indexterm zone="qt5 qt5-config">
        <primary sortas="e-etc-ld.so.conf">/etc/ld.so.conf</primary>
      </indexterm>

      <para>
        As the <systemitem class="username">root</systemitem> user, create
        the <filename>/etc/profile.d/qt5.sh</filename> file:
      </para>

<screen role="root"><userinput>cat &gt; /etc/profile.d/qt5.sh &lt;&lt; EOF
<literal># Begin /etc/profile.d/qt5.sh

QT5DIR=/opt/qt5

pathappend /opt/qt5/bin           PATH
pathappend /opt/qt5/lib/pkgconfig PKG_CONFIG_PATH

export QT5DIR

# End /etc/profile.d/qt5.sh</literal>
EOF</userinput></screen>

    </sect3>

   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 
               href="../../xincludes/setqt.xml"/>
  </sect2>

  <sect2 role="content">
    <title>Contents</title>

    <segmentedlist>
      <segtitle>Installed Programs</segtitle>
      <segtitle>Installed Libraries</segtitle>
      <segtitle>Installed Directories</segtitle>

      <seglistitem>
        <seg>
          assistant, designer, lconvert, linguist, lrelease,
          lupdate, moc, pixeltool, qcollectiongenerator, qdbuscpp2xml,
          qdbus, qdbusviewer, qdbusxml2cpp, qdoc, qhelpconverter,
          qhelpgenerator, qlalr, qmake, qml1plugindump, qmlbundle,
          qmlimportscanner, qmlmin, qmlplugindump, qmlprofiler, qml,
          qmlscene, qmltestrunner, qmlviewer, qtdiag, qtpaths, rcc,
          syncqt.pl, uic, xmlpatterns, and xmlpatternsvalidator
        </seg>
        <seg>
          libEnginio.so, libqgsttools_p.so, libQt5Bluetooth.so,
          libQt5Bootstrap.a, libQt5CLucene.so, libQt5Concurrent.so,
          libQt5Core.so, libQt5DBus.so, libQt5Declarative.so,
          libQt5DesignerComponents.so, libQt5Designer.so, libQt5Gui.so,
          libQt5Help.so, libQt5MultimediaQuick_p.so, libQt5Multimedia.so,
          libQt5MultimediaWidgets.so, libQt5Network.so, libQt5Nfc.so,
          libQt5OpenGLExtensions.a, libQt5OpenGL.so, libQt5PlatformSupport.a,
          libQt5Positioning.so, libQt5PrintSupport.so, libQt5QmlDevTools.a,
          libQt5Qml.so, libQt5QuickParticles.so, libQt5QuickWidgets.so,
          libQt5Quick.so, libQt5QuickTest.so, libQt5Script.so,
          libQt5ScriptTools.so, libQt5Sensors.so, libQt5SerialPort.so,
          libQt5Sql.so, libQt5Svg.so, libQt5Test.so, libQt5UiTools.a,
          libQt5WebKit.so, libQt5WebKitWidgets.so, libQt5WebSockets.so,
          libQt5Widgets.so, libQt5X11Extras.so, libQt5XmlPatterns.so,
          libQt5Xml.so, and several plugins under /opt/qt5/{imports,plugins,qml}
        </seg>
        <seg>
          /usr/include/qt5,
          /usr/lib/qt5,
          /usr/share/doc/qt5, and
          /usr/share/qt5
          OR
          /opt/qt5 and
          /opt/qt-&qt5-version;
        </seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="assistant-qt5">
        <term><command>assistant</command></term>
        <listitem>
          <para>
            is a tool for presenting on-line documentation.
          </para>
          <indexterm zone="qt5 assistant-qt5">
            <primary sortas="b-assistant-qt5">assistant</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="designer-qt5">
        <term><command>designer</command></term>
        <listitem>
          <para>
            is a full-fledged GUI builder. It includes
            powerful features such as preview mode, automatic widget
            layout, support for custom widgets, and an advanced
            property editor.
          </para>
          <indexterm zone="qt5 designer-qt5">
            <primary sortas="b-designer-qt5">designer</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="linguist-qt5">
        <term><command>linguist</command></term>
        <listitem>
          <para>
            provides support for translating applications into
            local languages.
          </para>
          <indexterm zone="qt5 linguist-qt5">
            <primary sortas="b-linguist-qt5">linguist</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="lrelease-qt5">
        <term><command>lrelease</command></term>
        <listitem>
          <para>
            is a simple command line tool. It reads a Qt project
            file and produces message files used by the application.
          </para>
          <indexterm zone="qt5 lrelease-qt5">
            <primary sortas="b-lrelease-qt5">lrelease</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="lupdate-qt5">
        <term><command>lupdate</command></term>
        <listitem>
          <para>
            reads a Qt project file, finds the translatable
            strings in the specified source, header and Qt Designer
            interface files, and produces or updates the translation
            files listed in the project file.
          </para>
          <indexterm zone="qt5 lupdate-qt5">
            <primary sortas="b-lupdate-qt5">lupdate</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="moc-qt5">
        <term><command>moc</command></term>
        <listitem>
          <para>
            generates Qt meta object support code.
          </para>
          <indexterm zone="qt5 moc-qt5">
            <primary sortas="b-moc-qt5">moc</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pixeltool-qt5">
        <term><command>pixeltool</command></term>
        <listitem>
          <para>
            is a desktop magnifier and as you move your mouse around
            the screen it will show the magnified contents in its window.
          </para>
          <indexterm zone="qt5 pixeltool-qt5">
            <primary sortas="b-pixeltool-qt5">pixeltool</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="qmake-qt5">
        <term><command>qmake</command></term>
        <listitem>
          <para>
            uses information stored in project files to
            determine what should go in the makefiles it
            generates.
          </para>
          <indexterm zone="qt5 qmake-qt5">
            <primary sortas="b-qmake-qt5">qmake</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="rcc-qt5">
        <term><command>rcc</command></term>
        <listitem>
          <para>
            is a resource compiler used in conjunction with designer.
          </para>
          <indexterm zone="qt5 rcc-qt5">
            <primary sortas="b-rcc-qt5">rcc</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="uic-qt5">
        <term><command>uic</command></term>
        <listitem>
          <para>
            is a Qt user interface compiler.
          </para>
          <indexterm zone="qt5 uic-qt5">
            <primary sortas="b-uic-qt5">uic</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
