From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikhail Kryshen Subject: Re: QtCreator Packaging Date: Thu, 11 Oct 2018 10:11:51 +0300 Message-ID: <87d0sh0xfs.fsf@seashell.localdomain> References: <871s8xxk8y.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAV8t-0004p9-MQ for guix-devel@gnu.org; Thu, 11 Oct 2018 03:12:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAV8p-0005w7-Fw for guix-devel@gnu.org; Thu, 11 Oct 2018 03:12:19 -0400 Received: from mail.kryshen.net ([31.220.44.128]:40520) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gAV8o-0005u7-Em for guix-devel@gnu.org; Thu, 11 Oct 2018 03:12:14 -0400 In-Reply-To: <871s8xxk8y.fsf@posteo.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Brett Gilio , guix-devel --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable QtCreator does not have ./configure, you need to modify the configure phase to invoke qmake. I have already packaged QtCreator (we use it at university for a couple of courses), but haven't yet prepared proper patches for inclusion in Guix. See the attachment. It uses monolithic qt package instead of modular qtbase etc. I modified the qt package to enable qdoc (requires clang) and building of the documentation. Brett Gilio writes: > Hi all, > > I am beginning my attempt to package QtCreator. My approach, thus=20 > far, > has been to look over the build documentation for the project in > question, and then incrementally change the Scheme definition for=20 > the > package. Usually, this works out pretty well, but here I am=20 > running into > a configuring error that I am not sure how to make sense of=20 > because (as > far as I can see) it is not reporting an error. > > Here is the current package definition: > http://ix.io/1oTH > > Here is the kill ring for the build: > http://ix.io/1oTJ > > > --=20 > Brett M. Gilio > Free Software Foundation, Member > https://gnu.org/s/guix/ | https://emacs.org > =2D-=20 Mikhail --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline; filename=qt.scm Content-Transfer-Encoding: quoted-printable (define-module (petrsu packages qt) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (guix download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils) #:use-module (guix search-paths) #:use-module (gnu packages llvm) #:use-module ((gnu packages qt) #:prefix gnu:) #:use-module (gnu packages base) #:use-module (gnu packages commencement) ;; qt #:use-module (gnu packages bison) #:use-module (gnu packages compression) #:use-module (gnu packages cups) #:use-module (gnu packages databases) #:use-module (gnu packages documentation) #:use-module (gnu packages fontutils) #:use-module (gnu packages flex) #:use-module (gnu packages freedesktop) #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages gnuzilla) #:use-module (gnu packages gperf) #:use-module (gnu packages gstreamer) #:use-module (gnu packages gtk) #:use-module (gnu packages icu4c) #:use-module (gnu packages image) #:use-module (gnu packages linux) #:use-module (gnu packages maths) #:use-module (gnu packages pciutils) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages pulseaudio) #:use-module (gnu packages python) #:use-module (gnu packages ruby) #:use-module (gnu packages sdl) #:use-module (gnu packages tls) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xorg) #:use-module (gnu packages xml)) ;; =D0=9C=D0=BE=D0=B4=D0=B8=D1=84=D0=B8=D1=86=D0=B8=D1=80=D0=BE=D0=B2=D0=B0= =D0=BD=D0=BD=D1=8B=D0=B9 =D0=BF=D0=B0=D0=BA=D0=B5=D1=82 =D0=B8=D0=B7 (gnu p= ackages qt) c =D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5= =D0=BC clang =D0=B4=D0=BB=D1=8F ;; =D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B8 qdoc =D0=B8 =D0=B3=D0=B5=D0=BD=D0= =B5=D1=80=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F =D0=B4=D0=BE=D0= =BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=86=D0=B8=D0=B8. =D0=9A=D0=BE=D0= =BF=D0=B8=D1=8F =D0=BA=D0=BE=D0=B4=D0=B0 =D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0= =BE ;; =D0=BD=D0=B0=D1=81=D0=BB=D0=B5=D0=B4=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F= , =D1=82. =D0=BA. =D0=BF=D0=BB=D0=B0=D0=BD=D0=B8=D1=80=D1=83=D1=8E =D0=BE= =D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82=D1=8C =D0=BF=D0=B0=D1=82=D1=87. (define-public qt (package (name "qt") (version "5.11.1") (outputs '("out" "examples" "doc")) (source (origin (method url-fetch) (uri (string-append "http://download.qt.io/official_releases/qt/" (version-major+minor version) "/" version "/single/qt-everywhere-src-" version ".tar.xz")) (sha256 (base32 "0azva1wx298jh0xskymz8jic83yhxs1xfxf321wqd5lwiyq2qq1r")) (modules '((guix build utils))) (snippet '(begin ;; Remove qtwebengine, which relies on a bundled copy of ;; chromium. Not only does it fail compilation in qt 5.5: ;; 3rdparty/chromium/ui/gfx/codec/jpeg_codec.cc:362:10: ;; error: cannot convert =E2=80=98bool=E2=80=99 to =E2= =80=98boolean=E2=80=99 in return ;; it might also pose security problems. ;; Alternatively, we could use the "-skip qtwebengine" ;; configuration option. (delete-file-recursively "qtwebengine") ;; The following snippets are copied from their mondular-qt= counterparts. (for-each (lambda (dir) (delete-file-recursively (string-append "qtbase/src/3rd= party/" dir))) (list "double-conversion" "freetype" "harfbuzz-ng" "libpng" "libjpeg" "pcre2" "xcb" "xkbcommon" "zlib")) (for-each (lambda (dir) (delete-file-recursively dir)) (list "qtimageformats/src/3rdparty" "qtmultimedia/examples/multimedia/spectrum/3rdparty" "qtwayland/examples" "qtscxml/tests/3rdparty" "qtcanvas3d/examples/canvas3d/3rdparty")) ;; Tests depend on this example, which depends on the 3rd p= arty code. (substitute* "qtmultimedia/examples/multimedia/multimedia.p= ro" (("spectrum") "#")) (substitute* "qtxmlpatterns/tests/auto/auto.pro" (("qxmlquery") "# qxmlquery") (("xmlpatterns ") "# xmlpatterns")) (substitute* "qtwebglplugin/tests/plugins/platforms/platfor= ms.pro" (("webgl") "# webgl")) (substitute* "qtscxml/tests/auto/auto.pro" (("scion") "#")) (substitute* "qtnetworkauth/tests/auto/auto.pro" (("oauth1 ") "# oauth1 ")) (substitute* "qtremoteobjects/tests/auto/qml/qml.pro" (("integration") "# integration") (("usertypes") "# usertypes")) #t)))) (build-system gnu-build-system) (propagated-inputs `(("mesa" ,mesa))) (inputs `(("alsa-lib" ,alsa-lib) ("bluez" ,bluez) ("cups" ,cups) ("dbus" ,dbus) ("double-conversion" ,double-conversion) ("expat" ,expat) ("fontconfig" ,fontconfig) ("freetype" ,freetype) ("glib" ,glib) ("gstreamer" ,gstreamer) ("gst-plugins-base" ,gst-plugins-base) ("harfbuzz" ,harfbuzz) ("icu4c" ,icu4c) ("jasper" ,jasper) ("libinput" ,libinput-minimal) ("libjpeg" ,libjpeg) ("libmng" ,libmng) ("libpci" ,pciutils) ("libpng" ,libpng) ("libtiff" ,libtiff) ("libwebp" ,libwebp) ("libx11" ,libx11) ("libxcomposite" ,libxcomposite) ("libxcursor" ,libxcursor) ("libxext" ,libxext) ("libxfixes" ,libxfixes) ("libxi" ,libxi) ("libxinerama" ,libxinerama) ("libxkbcommon" ,libxkbcommon) ("libxml2" ,libxml2) ("libxrandr" ,libxrandr) ("libxrender" ,libxrender) ("libxslt" ,libxslt) ("libxtst" ,libxtst) ("mtdev" ,mtdev) ("mariadb" ,mariadb) ("nss" ,nss) ("openssl" ,openssl) ("postgresql" ,postgresql) ("pulseaudio" ,pulseaudio) ("pcre2" ,pcre2) ;("sqlite" ,sqlite) ("udev" ,eudev) ("unixodbc" ,unixodbc) ("wayland" ,wayland) ("xcb-util" ,xcb-util) ("xcb-util-image" ,xcb-util-image) ("xcb-util-keysyms" ,xcb-util-keysyms) ("xcb-util-renderutil" ,xcb-util-renderutil) ("xcb-util-wm" ,xcb-util-wm) ("zlib" ,zlib) ;; Required for QDoc ("clang" ,clang))) (native-inputs `(("bison" ,bison) ("flex" ,flex) ("gperf" ,gperf) ("perl" ,perl) ("pkg-config" ,pkg-config) ("python" ,python-2) ("ruby" ,ruby) ("which" ,(@ (gnu packages base) which)))) (arguments `(;;#:parallel-build? #f ; Triggers race condition in qtbase module on= Hydra. #:phases (modify-phases %standard-phases (add-after 'unpack 'set-environment (lambda* (#:key inputs outputs #:allow-other-keys) (let ((clang (assoc-ref inputs "clang"))) (setenv "LLVM_INSTALL_DIR" clang)) #t)) (add-after 'configure 'patch-bin-sh (lambda _ (substitute* '("qtbase/configure" "qtbase/mkspecs/features/qt_functions.prf" "qtbase/qmake/library/qmakebuiltins.cpp") (("/bin/sh") (which "sh"))) #t)) (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (examples (assoc-ref outputs "examples")) (doc (assoc-ref outputs "doc"))) (substitute* '("configure" "qtbase/configure") (("/bin/pwd") (which "pwd"))) (substitute* "qtbase/src/corelib/global/global.pri" (("/bin/ls") (which "ls"))) ;; do not pass "--enable-fast-install", which makes the ;; configure process fail (zero? (system* "./configure" "-verbose" "-prefix" out "-docdir" (string-append doc "/share/doc/qt5") "-headerdir" (string-append out "/include/qt5") "-archdatadir" (string-append out "/lib/qt5") "-datadir" (string-append out "/share/qt5") "-examplesdir" (string-append examples "/share/doc/qt5/examples")= ; 151MiB "-opensource" "-confirm-license" ;; These features require higher versions of Linux t= han the ;; minimum version of the glibc. See ;; src/corelib/global/minimum-linux_p.h. By disabli= ng these ;; features Qt5 applications can be used on the olde= st ;; kernels that the glibc supports, including the RH= EL6 ;; (2.6.32) and RHEL7 (3.10) kernels. "-no-feature-getentropy" ; requires Linux 3.17 "-no-feature-renameat2" ; requires Linux 3.16 ;; Do not build examples; for the time being, we ;; prefer to save the space and build time. "-no-compile-examples" ;; Most "-system-..." are automatic, but some use ;; the bundled copy by default. ;"-system-sqlite" "-system-harfbuzz" "-system-pcre" ;; explicitly link with openssl instead of dlopening= it "-openssl-linked" ;; explicitly link with dbus instead of dlopening it "-dbus-linked" ;; don't use the precompiled headers "-no-pch" ;; drop special machine instructions not supported ;; on all instances of the target ,@(if (string-prefix? "x86_64" (or (%current-target-system) (%current-system))) '() '("-no-sse2")) "-no-mips_dsp" "-no-mips_dspr2"))))) (add-after 'install 'patch-mkspecs (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (archdata (string-append out "/lib/qt5")) (mkspecs (string-append archdata "/mkspecs")) (qt_config.prf (string-append mkspecs "/features/qt_config.prf"))) ;; For each Qt module, let `qmake' uses search paths in the ;; module directory instead of all in QT_INSTALL_PREFIX. (substitute* qt_config.prf (("\\$\\$\\[QT_INSTALL_HEADERS\\]") "$$clean_path($$replace(dir, mkspecs/modules, ../../inc= lude/qt5))") (("\\$\\$\\[QT_INSTALL_LIBS\\]") "$$clean_path($$replace(dir, mkspecs/modules, ../../lib= ))") (("\\$\\$\\[QT_HOST_LIBS\\]") "$$clean_path($$replace(dir, mkspecs/modules, ../../lib= ))") (("\\$\\$\\[QT_INSTALL_BINS\\]") "$$clean_path($$replace(dir, mkspecs/modules, ../../bin= ))")) ;; Searches Qt tools in the current PATH instead of QT_HOS= T_BINS. (substitute* (string-append mkspecs "/features/qt_function= s.prf") (("cmd =3D \\$\\$\\[QT_HOST_BINS\\]/\\$\\$2") "cmd =3D $$system(which $${2}.pl 2>/dev/null || which $= ${2})")) ;; Resolve qmake spec files within qtbase by absolute path= s. (substitute* (map (lambda (file) (string-append mkspecs "/features/" file)) '("device_config.prf" "moc.prf" "qt_build_config.= prf" "qt_config.prf" "winrt/package_manifest.prf")) (("\\$\\$\\[QT_HOST_DATA/get\\]") archdata) (("\\$\\$\\[QT_HOST_DATA/src\\]") archdata)) #t))) (add-after 'unpack 'patch-paths ;; Use the absolute paths for dynamically loaded libs, otherwi= se ;; the lib will be searched in LD_LIBRARY_PATH which typically= is ;; not set in guix. (lambda* (#:key inputs #:allow-other-keys) ;; libresolve (let ((glibc (assoc-ref inputs ,(if (%current-target-system) "cross-libc" "libc")))) (substitute* '("qtbase/src/network/kernel/qdnslookup_unix.= cpp" "qtbase/src/network/kernel/qhostinfo_unix.c= pp") (("^\\s*(lib.setFileName\\(QLatin1String\\(\")(resolv\"\= \)\\);)" _ a b) (string-append a glibc "/lib/lib" b)))) ;; X11/locale (compose path) (substitute* "qtbase/src/plugins/platforminputcontexts/compo= se/generator/qtablegenerator.cpp" ;; Don't search in /usr/=E2=80=A6/X11/locale, =E2=80=A6 (("^\\s*m_possibleLocations.append\\(QStringLiteral\\(\"/u= sr/.*/X11/locale\"\\)\\);" line) (string-append "// " line)) ;; =E2=80=A6 but use libx11's path (("^\\s*(m_possibleLocations.append\\(QStringLiteral\\()X1= 1_PREFIX \"(/.*/X11/locale\"\\)\\);)" _ a b) (string-append a "\"" (assoc-ref inputs "libx11") b))) ;; libGL (substitute* "qtbase/src/plugins/platforms/xcb/gl_integratio= ns/xcb_glx/qglxintegration.cpp" (("^\\s*(QLibrary lib\\(QLatin1String\\(\")(GL\"\\)\\);)" = _ a b) (string-append a (assoc-ref inputs "mesa") "/lib/lib" b))) ;; libXcursor (substitute* "qtbase/src/plugins/platforms/xcb/qxcbcursor.cp= p" (("^\\s*(QLibrary xcursorLib\\(QLatin1String\\(\")(Xcursor= \"\\), 1\\);)" _ a b) (string-append a (assoc-ref inputs "libxcursor") "/lib/li= b" b)) (("^\\s*(xcursorLib.setFileName\\(QLatin1String\\(\")(Xcur= sor\"\\)\\);)" _ a b) (string-append a (assoc-ref inputs "libxcursor") "/lib/li= b" b))) #t)) (add-after 'install 'build-doc (lambda* (#:key inputs outputs make-flags #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (doc (assoc-ref outputs "doc"))) ;; qdoc fails without these, see QTBUG-67925 ;; Can't use absolute path as it causes reference cycle be= tween doc and out. ;; (setenv "QT_INSTALL_HEADERS" (string-append out "/inclu= de/qt5")) (setenv "QT_INSTALL_HEADERS" "include/qt5") (setenv "QT_INSTALL_DOCS" (string-append doc "/share/doc/q= t5"))) (apply invoke "make" "docs" make-flags))) (add-after 'build-doc 'install-doc (lambda _ (invoke "make" "install_docs")))))) (native-search-paths (list (search-path-specification (variable "QMAKEPATH") (files '("lib/qt5"))) (search-path-specification (variable "QML2_IMPORT_PATH") (files '("lib/qt5/qml"))) (search-path-specification (variable "QT_PLUGIN_PATH") (files '("lib/qt5/plugins"))) (search-path-specification (variable "XDG_DATA_DIRS") (files '("share"))) (search-path-specification (variable "XDG_CONFIG_DIRS") (files '("etc/xdg"))))) (home-page "https://www.qt.io/") (synopsis "Cross-platform GUI library") (description "Qt is a cross-platform application and UI framework for developers using C++ or QML, a CSS & JavaScript like language.") (license (list license:lgpl2.1 license:lgpl3)) ;; Qt 4: 'QBasicAtomicPointer' leads to build failures on MIPS; ;; see . ;; Qt 5: assembler error; see . (supported-systems (delete "mips64el-linux" %supported-systems)))) (define-public qtcreator (package (name "qtcreator") (version "4.7.0") (source (origin (method url-fetch) (uri (string-append "https://download.qt.io/official_releases/qtcrea= tor/4.7/" version "/qt-creator-opensource-src-" version ".tar.xz")) (sha256 ;; (base32 "1k23i1qsw6d06sy7g0vd699rbvwv6vbw211fy0nn0705a5zndbxv") = ; 4.6.2 (base32 "16vm1gcq5g3zpcq21xdn31drzlar2hm5583kmkg6adnlz05qf6ab")))) = ; 4.7.0 (build-system gnu-build-system) (arguments `(#:make-flags (list (string-append "INSTALL_ROOT=3D" (assoc-ref %outputs "out"))) #:validate-runpath? #f #:phases (modify-phases %standard-phases (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (clang (assoc-ref inputs "clang")) (llvm (assoc-ref inputs "llvm"))) (substitute* "src/shared/clang/clang_installation.pri" (("\\$\\$system\\(\\$\\$llvm_config --libdir, lines\\)") (string-append clang "/lib")) (("\\$\\$system\\(\\$\\$llvm_config --includedir, lines\\)= ") (string-append clang "/include"))) (invoke "qmake" (string-append "LLVM_INSTALL_DIR=3D" llvm))))) (add-after 'install 'build-doc (lambda* (#:key make-flags #:allow-other-keys) (apply invoke "make" "docs" make-flags))) (add-after 'build-doc 'install-doc (lambda* (#:key make-flags #:allow-other-keys) (apply invoke "make" "install_docs" make-flags)))))) (native-inputs `(("which" ,which))) (inputs `(("clang" ,clang) ("llvm" ,llvm) ("qt" ,qt))) (home-page "https://www.qt.io/ide/") (synopsis "Cross-platform IDE for Qt") (description "Qt Creator is a cross-platform IDE (integrated development environment) tailored to the needs of Qt developers.") (license license:gpl3))) ;; =D0=9E=D0=B1=D0=B5=D1=80=D0=BD=D1=83=D1=82=D1=8C qtcreator =D1=82=D0=B0= =D0=BA, =D1=87=D1=82=D0=BE=D0=B1=D1=8B =D0=BE=D0=BD =D0=B2=D0=B8=D0=B4=D0= =B5=D0=BB GCC =D0=B8 Qt =D0=B8=D0=B7 Guix. (define-public qtcreator-wrapped (package (inherit qtcreator) (name "qtcreator-wrapped") (inputs `(("gcc-toolchain" ,gcc-toolchain-8) ,@(package-inputs qtcreator))) (arguments (substitute-keyword-arguments (package-arguments qtcreator) ((#:phases phases) `(modify-phases ,phases (add-after 'install 'wrap-program (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (qt (assoc-ref inputs "qt")) (gcc (assoc-ref inputs "gcc-toolchain"))) (wrap-program (string-append out "/bin/qtcreator") `("PATH" ":" prefix (,(string-append qt "/bin") ,(string-append gcc "/bin"))) `("CPATH" ":" prefix (,(string-append gcc "/include"))) `("LIBRARY_PATH" ":" prefix (,(string-append gcc "/lib"))))) #t)))))))) --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAEBCAAdFiEEw6yVFU/UQfkLWikDzxz0c4HWsG4FAlu+97sACgkQzxz0c4HW sG65xgwAj1jZTUrWtovfJR7kJSYdwVGEuQNh+gBLR5wK5ihN6bkjZlRBCfu85WON EbufF8u8iC5M0EgB4MJCAZiZC2gV85jL+w0ZQ7A7Y7LPa+eV74N5ouB5SlMoXlG1 Za4m9rstB2QA209O8DJVdiZhODKgnFZxHssdXMnpJZU+smQP/pTFcQlYpnL5HSY2 1vSRnERZRkLzhAw7hJxGEm2iwSV+otU0dCQk6YoX/3GuMzILwIpY5Fuh/enzKw9V xAUprxY9fSb8OsP4hbfbiqTNapcq6lI02l1r/aqGTmEFmvrUwvz8OBUs7+19r6No f59vL+myxzxmMf3VWQBS5xZbFXwuWHIeVWeQKwQXk18UAhSvgE9Rur7gIzQvU6uF hhyMKlkLRk4JPRxPMYYOgntNWM5S0mqziFNPY4JMThItuYiNAq57c4S5vPIwurtt x+2O7uchBv3FLymB8+QWEqgzfj6BAcOp+ffz9jE1q72ZXAnScDzAE2zwrw7yartQ yBm//28z =zw+J -----END PGP SIGNATURE----- --==-=-=--