summaryrefslogtreecommitdiff
path: root/packages/komodo/qaterial.scm
diff options
context:
space:
mode:
Diffstat (limited to 'packages/komodo/qaterial.scm')
-rw-r--r--packages/komodo/qaterial.scm235
1 files changed, 235 insertions, 0 deletions
diff --git a/packages/komodo/qaterial.scm b/packages/komodo/qaterial.scm
new file mode 100644
index 0000000..a430c2d
--- /dev/null
+++ b/packages/komodo/qaterial.scm
@@ -0,0 +1,235 @@
+(define-module (qaterial)
+ #:use-module (gnu packages qt)
+ #:use-module (googlefontcmake)
+ #:use-module (guix build utils)
+ #:use-module (guix build-system copy)
+ #:use-module (guix build-system cmake)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module ((guix licenses)
+ #:prefix license:)
+ #:use-module (guix packages)
+ #:use-module (qolm)
+ #:use-module (qtgeneratorcmake))
+
+;; DATA LAYER
+
+(define cmake-fetchgooglefontcmake
+ "cmake/FetchGoogleFontCMake.cmake")
+
+(define cmakelists-fonts
+ "qml/Qaterial/Fonts/CMakeLists.txt")
+
+(define cmakelists-icons
+ "qml/Qaterial/Icons/CMakeLists.txt")
+
+(define cmakelists-root
+ "CMakeLists.txt")
+
+(define description
+ "A collection of Material Components to build faster UI using Qml.")
+
+(define disable-icons
+ "set(QATERIAL_ENABLE_ICONS OFF")
+
+(define disable-lato
+ "set(QATERIAL_ENABLE_LATO OFF")
+
+(define disable-roboto
+ "set(QATERIAL_ENABLE_ROBOTO OFF")
+
+(define disable-robotomono
+ "set(QATERIAL_ENABLE_ROBOTOMONO OFF")
+
+(define enable-build-shared
+ "set(QATERIAL_BUILD_SHARED ON")
+
+(define fetcher-fonts
+ "include\\(\\$\\{PROJECT_SOURCE_DIR\\}\\/cmake\\/FetchGoogleFontCMake.cmake\\)")
+
+(define fetcher-qolm
+ "include\\(cmake\\/FetchQOlm.cmake\\)")
+
+(define file-generateqrc
+ "cmake/GenerateQrc.cmake")
+
+(define fetcher-qtgeneratorcmake
+ "include\\(cmake\\/FetchQtGeneratorCMake.cmake\\)")
+
+(define hash
+ (base32 "19xvgk4h908x0zgxy63fqmrsb5df613vhr5h7cpsgg7nllglypss"))
+
+(define hook-enable-icons
+ "set\\(QATERIAL_ENABLE_ICONS ON")
+
+(define hook-qaterial-generate-icons-class
+ "qaterial_generate_icons_class\\(\\$\\{QATERIAL_ICONS_CLASS_FILE\\} \\$\\{QATERIAL_ICONS_SRC_FILE\\}\\)")
+
+(define head-hook
+ "include\\(cmake\\/Version.cmake\\)")
+
+(define home-page
+ "https://olivierldff.github.io/Qaterial")
+
+(define hook-icons
+ "include\\(\\$\\{PROJECT_SOURCE_DIR\\}\\/cmake\\/FetchMaterialDesignIcons.cmake\\)")
+
+(define name
+ "qaterial")
+
+(define null-string
+ "")
+
+(define setter-build-shared
+ "set\\(QATERIAL_BUILD_SHARED OFF")
+
+(define setter-lato
+ "set\\(QATERIAL_ENABLE_LATO ON")
+
+(define setter-roboto
+ "set\\(QATERIAL_ENABLE_ROBOTO ON")
+
+(define setter-robotomono
+ "set\\(QATERIAL_ENABLE_ROBOTOMONO ON")
+
+(define synopsis
+ "🧩 Collection of Material Components based on QtQuickControls2.")
+
+(define url
+ "https://github.com/OlivierLDff/Qaterial.git")
+
+(define version
+ "v1.4.9")
+
+;; ABSTRACTION LAYER -4
+
+(define link-qtgeneratorcmake
+ '(string-append "include(cmake/Version.cmake)\n"
+ "include("
+ path-qtgeneratorcmake
+ "/cmake/GenerateQrc.cmake"
+ ")\n"
+ "include("
+ path-qtgeneratorcmake
+ "/cmake/GenerateQmldir.cmake"
+ ")\n"
+ "include("
+ path-qtgeneratorcmake
+ "/cmake/GenerateQrcAliasQtObject.cmake"
+ ")\n"))
+
+;; ABSTRACTION LAYER -3
+
+(define clause-delete-fetchers
+ `(lambda _
+ (substitute* ,cmakelists-root
+ ((,fetcher-qolm)
+ ,null-string))
+ (substitute* ,cmakelists-root
+ ((,fetcher-qtgeneratorcmake)
+ ,null-string))
+ (substitute* ,cmakelists-root
+ ((,setter-roboto)
+ ,disable-roboto))
+ (substitute* ,cmakelists-root
+ ((,setter-robotomono)
+ ,disable-robotomono))
+ (substitute* ,cmakelists-root
+ ((,setter-lato)
+ ,disable-lato))
+ (substitute* ,cmakelists-fonts
+ ((,fetcher-fonts)
+ ,null-string))
+ (substitute* ,cmakelists-icons
+ ((,hook-icons)
+ ,null-string))
+ (substitute* ,cmakelists-root
+ ((,hook-enable-icons)
+ ,disable-icons))
+ (substitute* ,cmakelists-root
+ (("\\# ───── QATERIAL TARGET ─────")
+ "find_package(QOlm)"))))
+
+;; (define clause-hack-icon-generator
+;; `(lambda _
+;; (invoke "echo" ,qaterial-fix ">" "cmake/QaterialGenerateIcons.cmake")))
+
+(define clause-link-qtgenerator
+ `(lambda* (#:key inputs #:allow-other-keys)
+ (let ((path-qtgeneratorcmake (assoc-ref inputs "qtgeneratorcmake")))
+ (substitute* ,cmakelists-root
+ ((,head-hook)
+ ,link-qtgeneratorcmake)))))
+
+(define clause-set-build-shared
+ `(lambda _
+ (substitute* ,cmakelists-root
+ ((,setter-build-shared)
+ ,enable-build-shared))))
+
+;; ABSTRACTION LAYER -2
+
+(define phase-delete-fetchers
+ `(add-before 'configure
+ 'delete-fetchers
+ ,clause-delete-fetchers))
+
+;; (define phase-hack-icon-generator
+;; `(add-before 'configure
+;; 'hack-icon-generator
+;; ,clause-hack-icon-generator))
+
+(define phase-link-qtgenerator
+ `(add-before 'configure
+ 'link-qtgenerator
+ ,clause-link-qtgenerator))
+
+(define phase-set-build-shared
+ `(add-before 'configure
+ 'set-build-shared
+ ,clause-set-build-shared))
+
+;; ABSTRACTION LAYER -1
+
+(define phases
+ `(modify-phases %standard-phases
+ ,phase-delete-fetchers
+ ,phase-set-build-shared
+ ,phase-link-qtgenerator
+ ;; ,phase-hack-icon-generator
+ ))
+
+(define uri
+ (git-reference (url url)
+ (commit version)))
+
+;; ABSTRACTION LAYER -0
+
+(define arguments
+ (list #:phases phases
+ #:tests? #f))
+
+(define inputs
+ (list googlefontcmake qolm qtbase-5 qtdeclarative-5
+ qtgeneratorcmake qtquickcontrols2-5 qtsvg-5))
+
+(define source
+ (origin (uri uri)
+ (method git-fetch)
+ (sha256 hash)
+ (patches (list (local-file "Qaterial.patch")))))
+
+;; SURFACE LAYER
+
+(define-public qaterial
+ (package (name name)
+ (version version)
+ (source source)
+ (build-system cmake-build-system)
+ (arguments arguments)
+ (inputs inputs)
+ (synopsis synopsis)
+ (description description)
+ (license license:expat)
+ (home-page home-page)))