Qt package guideline


Introduction

QT Applications have build steps nativly like this:

$ qmake
$ make
$ make install

On the other hand, PantherX has some Build Systems for C/C++ packages:

  1. gnu-build-system : configure & make & make install.
  2. cmake-build-system : cmake & make & make install.
  3. qt-build-system : qmake & make & make install.
  4. trivial-build-system : Every thing should be defined in the package definition.

With above descriptions, for packaging a Qt Application For PantherX we should select 1., 2. or 3. and customize/replace some steps in guix build system.

PantherX Specifics

We can replace some steps in package building/installation. Here is a piece of package definition. In this sample the gnu-build-system used. And generally two things added to the package definition:

  1. Replacing the configure step.
    At this step we should run qmake - with needed parameters.

  2. Adding some instruction for correcting the installation path, before starting the install step.
    At this step we should modify the installation path in Makefile(s). In this example the (substitute* ....) method used for replacing the out path instead of $INSTALL_ROOT/usr.

(build-system gnu-build-system)
(arguments
 `(#:phases
   (modify-phases %standard-phases
     (replace 'configure
       (lambda _
         (invoke "qmake" "CONFIG+=without_djvu without_cups" "qpdfview.pro")))
     ;; Installation process hard-codes "/usr/bin", possibly
     ;; prefixed.
     (add-before 'install 'fix-install-directory
       (lambda* (#:key outputs #:allow-other-keys)
         (let ((out (assoc-ref outputs "out")))
           (substitute* "Makefile.pdf-plugin" (("\\$\\(INSTALL_ROOT\\)/usr") out))
           (substitute* "Makefile.ps-plugin" (("\\$\\(INSTALL_ROOT\\)/usr") out))
           (substitute* "Makefile.image-plugin" (("\\$\\(INSTALL_ROOT\\)/usr") out))
           (substitute* "Makefile.application" (("\\$\\(INSTALL_ROOT\\)/usr") out))
           #t)))
     )))

Examples

  1. qpdfview - Package Link
  2. qview - Package Link

Packaging the applications with QtWebEngine as dependency

If you developed one application which is using the QtWebEngine library, you should update the path of QtWebEngineProcess in the package definition, like the example:

...
      (arguments
        `(#:phases
          (modify-phases %standard-phases
            (add-after 'install 'wrap
              ;; The program fails to find the QtWebEngineProcess program,
              ;; so we set QTWEBENGINEPROCESS_PATH to help it.
              (lambda* (#:key inputs outputs #:allow-other-keys)
                (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
                      (qtwebengineprocess (string-append
                                            (assoc-ref inputs "qtwebengine")
                                            "/lib/qt5/libexec/QtWebEngineProcess")))
                  (for-each (lambda (program)
                              (wrap-program program
                                `("QTWEBENGINEPROCESS_PATH" =
                                  (,qtwebengineprocess))))
                            (find-files bin ".*")))
                #t)))))
...

Examples

You can find many examples in upstream. It’s enough to search qtwebengine in upstream guix package repository.

PantherX & (unofficial) GNU Guix Wiki.

Last update: 2024-04-21 10:28:03 +0000 | Apache-2.0

Inspired by the excellent Arch Linux Wiki