[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: QtCreator Packaging
From: |
Mikhail Kryshen |
Subject: |
Re: QtCreator Packaging |
Date: |
Thu, 11 Oct 2018 10:11:51 +0300 |
User-agent: |
Notmuch/0.27 (https://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) |
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 <address@hidden> writes:
> Hi all,
>
> I am beginning my attempt to package QtCreator. My approach, thus
> far,
> has been to look over the build documentation for the project in
> question, and then incrementally change the Scheme definition for
> the
> package. Usually, this works out pretty well, but here I am
> running into
> a configuring error that I am not sure how to make sense of
> 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
>
>
> --
> Brett M. Gilio
> Free Software Foundation, Member
> https://gnu.org/s/guix/ | https://emacs.org
>
--
Mikhail
(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))
;; Модифицированный пакет из (gnu packages qt) c добавлением clang для
;; сборки qdoc и генерирования документации. Копия кода вместо
;; наследования, т. к. планирую отправить патч.
(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 ‘bool’ to ‘boolean’ 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/3rdparty/" 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 party
code.
(substitute* "qtmultimedia/examples/multimedia/multimedia.pro"
(("spectrum") "#"))
(substitute* "qtxmlpatterns/tests/auto/auto.pro"
(("qxmlquery") "# qxmlquery")
(("xmlpatterns ") "# xmlpatterns"))
(substitute*
"qtwebglplugin/tests/plugins/platforms/platforms.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 than
the
;; minimum version of the glibc. See
;; src/corelib/global/minimum-linux_p.h. By disabling
these
;; features Qt5 applications can be used on the oldest
;; kernels that the glibc supports, including the RHEL6
;; (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,
../../include/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_HOST_BINS.
(substitute* (string-append mkspecs
"/features/qt_functions.prf")
(("cmd = \\$\\$\\[QT_HOST_BINS\\]/\\$\\$2")
"cmd = $$system(which $${2}.pl 2>/dev/null || which
$${2})"))
;; Resolve qmake spec files within qtbase by absolute paths.
(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, otherwise
;; 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.cpp")
(("^\\s*(lib.setFileName\\(QLatin1String\\(\")(resolv\"\\)\\);)" _ a b)
(string-append a glibc "/lib/lib" b))))
;; X11/locale (compose path)
(substitute*
"qtbase/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp"
;; Don't search in /usr/…/X11/locale, …
(("^\\s*m_possibleLocations.append\\(QStringLiteral\\(\"/usr/.*/X11/locale\"\\)\\);"
line)
(string-append "// " line))
;; … but use libx11's path
(("^\\s*(m_possibleLocations.append\\(QStringLiteral\\()X11_PREFIX
\"(/.*/X11/locale\"\\)\\);)" _ a b)
(string-append a "\"" (assoc-ref inputs "libx11") b)))
;; libGL
(substitute*
"qtbase/src/plugins/platforms/xcb/gl_integrations/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.cpp"
(("^\\s*(QLibrary
xcursorLib\\(QLatin1String\\(\")(Xcursor\"\\), 1\\);)" _ a b)
(string-append a (assoc-ref inputs "libxcursor") "/lib/lib"
b))
(("^\\s*(xcursorLib.setFileName\\(QLatin1String\\(\")(Xcursor\"\\)\\);)" _ a b)
(string-append a (assoc-ref inputs "libxcursor") "/lib/lib"
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
between doc and out.
;; (setenv "QT_INSTALL_HEADERS" (string-append out
"/include/qt5"))
(setenv "QT_INSTALL_HEADERS" "include/qt5")
(setenv "QT_INSTALL_DOCS" (string-append doc
"/share/doc/qt5")))
(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 <http://hydra.gnu.org/build/112828>.
;; Qt 5: assembler error; see <http://hydra.gnu.org/build/112526>.
(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/qtcreator/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=" (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=" 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)))
;; Обернуть qtcreator так, чтобы он видел GCC и Qt из 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))))))))
signature.asc
Description: PGP signature