Subject: Re: bug#49943: [PATCH] gnu: Add openboard

From: Nicolas Goaziou <[email-masked]>
Date: Thu, 24 Feb 2022 22:32:54 +0100

Hello,

Maxim Cournoyer <[email-masked]> writes:

> I tried to build it, but it failed with:

Thank you for the feedback!

> --8<---------------cut here---------------start------------->8---
> g++ -c -m64 -pipe -std=c++11 -fopenmp -O2 -std=gnu++1y -w -D_REENTRANT -fPIC -DNO_THIRD_PARTY_WARNINGS -DUBVERSION="\"1.6.1."\" -DUBVERSION_RC=1,6,1,240,0309 -DQT_NO_DEBUG -DQT_WEBKITWIDGETS_LIB -DQT_WEBKIT_LIB -DQT_SVG_LIB -DQT_UITOOLS_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_XMLPATTERNS_LIB -DQT_NETWORK_LIB -DQT_XML_LIB -DQT_CORE_LIB -Isrc -Isrc/web/browser -Isrc/qtsingleapplication/src -Isrc/pdf-merger -Iplugins/cffadaptor/src -I/gnu/store/2nsrbbnw4174rnmaw8mkdgd0939fwj1h-quazip-1.2/include/quazip5 -I/gnu/store/jf1972y4lzipm4h17spkzaclb0ifflv0-poppler-21.07.0/include/poppler -I/gnu/store/0gabd8wshbc917y3m4mcqndnnf6gv572-qtwebkit-5.212.0-alpha4/include/QtWebKitWidgets -I/gnu/store/0gabd8wshbc917y3m4mcqndnnf6gv572-qtwebkit-5.212.0-alpha4/include/QtWebKit -I/gnu/store/c7m7mihwj3sn9gbvyb2d1ma62hlifgkn-qtsvg-5.15.2/include/qt5 -I/gnu/store/c7m7mihwj3sn9gbvyb2d1ma62hlifgkn-qtsvg-5.15.2/include/qt5/QtSvg -I/gnu/store/3cpa4lv4gx2nkiyvg4xkcalvvjv6y1vq-qttools-5.15.2/include/qt5 -I/gnu/store/3cpa4lv4gx2nkiyvg4xkcalvvjv6y1vq-qttools-5.15.2/include/qt5/QtUiTools -I/gnu/store/dk284553z4sgpd0jivggham4i70z1b65-qtmultimedia-5.15.2/include/qt5 -I/gnu/store/dk284553z4sgpd0jivggham4i70z1b65-qtmultimedia-5.15.2/include/qt5/QtMultimediaWidgets -I/gnu/store/v8yw01fvwdm95jvqa82sylw6qznmh2mi-qtbase-5.15.2/include/qt5 -I/gnu/store/v8yw01fvwdm95jvqa82sylw6qznmh2mi-qtbase-5.15.2/include/qt5/QtPrintSupport -I/gnu/store/v8yw01fvwdm95jvqa82sylw6qznmh2mi-qtbase-5.15.2/include/qt5/QtWidgets -I/gnu/store/dk284553z4sgpd0jivggham4i70z1b65-qtmultimedia-5.15.2/include/qt5/QtMultimedia -I/gnu/store/v8yw01fvwdm95jvqa82sylw6qznmh2mi-qtbase-5.15.2/include/qt5/QtGui -I/gnu/store/f96i1vssl11vk483570ki90g56mhpiz1-qtxmlpatterns-5.15.2/include/qt5 -I/gnu/store/f96i1vssl11vk483570ki90g56mhpiz1-qtxmlpatterns-5.15.2/include/qt5/QtXmlPatterns -I/gnu/store/v8yw01fvwdm95jvqa82sylw6qznmh2mi-qtbase-5.15.2/include/qt5/QtNetwork -I/gnu/store/v8yw01fvwdm95jvqa82sylw6qznmh2mi-qtbase-5.15.2/include/qt5/QtXml -I/gnu/store/v8yw01fvwdm95jvqa82sylw6qznmh2mi-qtbase-5.15.2/include/qt5/QtCore -Ibuild/linux/release/moc -I/gnu/store/ikghb2zrjjl5944gxqkls89rrbd1qn24-libdrm-2.4.107/include/libdrm -Ibuild/linux/release/ui -I/gnu/store/v8yw01fvwdm95jvqa82sylw6qznmh2mi-qtbase-5.15.2/lib/qt5/mkspecs/linux-g++-64 -o build/linux/release/objects/UBDrawingController.o src/board/UBDrawingController.cpp
> In file included from src/adaptors/UBExportDocumentSetAdaptor.cpp:28:
> src/adaptors/UBExportDocumentSetAdaptor.h:36:10: fatal error: quazip.h: No such file or directory
>    36 | #include "quazip.h"
>       |          ^~~~~~~~~~
> compilation terminated.
> make[1]: *** [Makefile.Release:3415: build/linux/release/objects/UBExportDocumentSetAdaptor.o] Error 1
> make[1]: *** Waiting for unfinished jobs....
> src/adaptors/UBImportDocumentSetAdaptor.cpp:44:10: fatal error: quazip.h: No such file or directory
>    44 | #include "quazip.h"
>       |          ^~~~~~~~~~
> compilation terminated.
> make[1]: *** [Makefile.Release:3436: build/linux/release/objects/UBImportDocumentSetAdaptor.o] Error 1
> src/adaptors/UBImportDocument.cpp:46:14: fatal error: quazip.h: No such file or directory
>    46 |     #include "quazip.h"
>       |              ^~~~~~~~~~
> compilation terminated.
> make[1]: *** [Makefile.Release:3274: build/linux/release/objects/UBImportDocument.o] Error 1
> src/adaptors/UBImportCFF.cpp:52:14: fatal error: quazip.h: No such file or directory
>    52 |     #include "quazip.h"
>       |              ^~~~~~~~~~
> compilation terminated.
> src/adaptors/UBExportWeb.cpp:42:10: fatal error: quazip.h: No such file or directory
>    42 | #include "quazip.h"
>       |          ^~~~~~~~~~
> compilation terminated.
> make[1]: *** [Makefile.Release:3491: build/linux/release/objects/UBImportCFF.o] Error 1
> make[1]: *** [Makefile.Release:3384: build/linux/release/objects/UBExportWeb.o] Error 1
> src/adaptors/UBExportDocument.cpp:46:14: fatal error: quazip.h: No such file or directory
>    46 |     #include "quazip.h"
>       |              ^~~~~~~~~~
> compilation terminated.
> make[1]: *** [Makefile.Release:3149: build/linux/release/objects/UBExportDocument.o] Error 1
> make[1]: Leaving directory '/tmp/guix-build-openboard-1.6.1.drv-0/source'
> make: *** [Makefile:42: release] Error 2
> error: in phase 'build': uncaught exception:
> %exception #<&invoke-error program: "make" arguments: ("-j" "24") exit-status: 2 term-signal: #f stop-signal: #f> 
> phase `build' failed after 6.6 seconds
> --8<---------------cut here---------------end--------------->8---
>
> Perhaps something changed since with our quazip package?

I can build it with the following new-style package definition (although
it is still a bit crashy):

--8<---------------cut here---------------start------------->8---
(define-public openboard
  (package
    (name "openboard")
    (version "1.6.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/OpenBoard-org/OpenBoard")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1wvkd5zmv7d7ng3basm323zah9gqnj6v57kf31zjk1i0hcc9fl9s"))))
    (build-system qt-build-system)
    (arguments
     `(#:tests? #f                      ;no tests
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'set-initial-values
           ;; Remove useless "Check for updates" action from menu.
           ;; Also prevent pop-up window about importing Open Sankore
           ;; documents since we don't package OpenBoard-Importer.
           (lambda _
             (substitute* "src/core/UBSettings.cpp"
               (("(appHideCheckForSoftwareUpdate = .*?)false(\\);)" _ start end)
                (string-append start "true" end))
               (("(appLookForOpenSankoreInstall = .*?)true(\\);)" _ start end)
                (string-append start "false" end)))))
         (add-after 'unpack 'fix-hard-coded-env
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "src/frameworks/UBPlatformUtils_linux.cpp"
               (("/usr/bin/env") (search-input-file inputs "/bin/env")))))
         (add-after 'unpack 'fix-library-path
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "OpenBoard.pro"
               (("/usr/include/quazip")
                (search-input-directory inputs "/include/quazip5"))
               (("/usr/include/poppler")
                (search-input-directory inputs "/include/poppler")))))
         (replace 'configure
           (lambda _
             ;; XXX: Invoking "lrelease-pro" on "OpenBoard.pro" fails
             ;; with "WARNING: Could not find qmake spec 'default'"
             ;; error.  So, we compile translations manually.
             (for-each (lambda (f) (invoke "lrelease" f))
                       (find-files "resources/i18n" "\\.ts$"))
             (invoke "qmake"
                     "-spec"
                     ,(if (string-prefix? "x86_64" (%current-system))
                          "linux-g++-64"
                          "linux-g++"))))
         (replace 'install
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (share (string-append out "/share"))
                    (openboard (string-append share "/openboard"))
                    (i18n (string-append openboard "/i18n")))
               ;; Install data.
               (with-directory-excursion "resources"
                 (for-each (lambda (directory)
                             (let ((target
                                    (string-append openboard "/" directory)))
                               (mkdir-p target)
                               (copy-recursively directory target)))
                           '("customizations" "etc" "library"))
                 (mkdir-p i18n)
                 (for-each (lambda (f)
                             (install-file f i18n))
                           (find-files "i18n" "\\.qm$")))
               ;; Install desktop file an icon.
               (install-file "resources/images/OpenBoard.png"
                             (string-append share "/icons/hicolor/64x64/apps/"))
               (make-desktop-entry-file
                (string-append share "/applications/" ,name ".desktop")
                #:name "OpenBoard"
                #:comment "Interactive whiteboard application"
                #:exec "openboard %f"
                #:icon "OpenBoard"
                #:mime-type "application/ubz"
                #:categories '("Education"))
               ;; Install executable.
               (install-file "build/linux/release/product/OpenBoard" openboard)
               (let ((bin (string-append out "/bin")))
                 (mkdir-p bin)
                 (symlink (string-append openboard "/OpenBoard")
                          (string-append bin "/openboard")))))))))
    (native-inputs
     (list qttools))
    (inputs
     (list alsa-lib
           ffmpeg
           freetype
           lame
           libass
           libfdk
           libressl
           libtheora
           libva
           libvorbis
           libvpx
           libx264
           opus
           poppler
           qtbase-5
           qtmultimedia
           qtsvg
           qtwebkit
           qtxmlpatterns
           quazip-0
           sdl
           zlib))
    (home-page "https://openboard.ch/")
    (synopsis "Interactive whiteboard for schools and universities")
    (description
     "OpenBoard is a teaching software for interactive whiteboard
designed primarily for use in schools and universities.  It can be
used both with interactive whiteboards or in a dual-screen setup with
a pen-tablet display and a beamer.")
    (license license:gpl3)))
--8<---------------cut here---------------end--------------->8---

Let me know if you'd rather have a patch.

Regards,
-- 
Nicolas Goaziou