Skip to content

Instantly share code, notes, and snippets.

@zamfofex
Last active December 1, 2022 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamfofex/c5d64a60c19d9c0a4f3343e8b444dfd9 to your computer and use it in GitHub Desktop.
Save zamfofex/c5d64a60c19d9c0a4f3343e8b444dfd9 to your computer and use it in GitHub Desktop.
Ladybird for Guix
; License: AGPL, v3 or later
; Copyright: zamfofex, November of 2022
(use-modules
(guix packages)
(guix download)
(guix git-download)
(guix build-system qt)
(guix gexp)
((guix licenses) #:prefix license:)
(gnu packages qt)
(gnu packages gl)
(gnu packages gcc)
(gnu packages xdisorg)
(gnu packages tls))
(define serenity-source
(origin
(method git-fetch)
(uri
(git-reference
(url "https://github.com/SerenityOS/serenity")
(commit "fd6bb41519d01390e7a8b1ed6554a58b38d6cb88")))
(file-name (git-file-name "serenity" "0"))
(sha256 (base32 "0gwbkrndqyrxd1z1rf0w5zdg3sa475c4dhnf765jdpx4b2nlk9sm"))
(modules '((guix build utils)))
(snippet
'(begin
; (delete-file "Userland/Libraries/LibUnicode/Normalize.cpp")
; (substitute* "Userland/Libraries/LibUnicode/CMakeLists.txt"
; (("\\bNormalize\\.cpp\\b") ""))
(substitute* "Meta/CMake/utils.cmake"
(("Downloading file \\$\\{file} from \\$\\{url}") "Downloading file ${path} from ${url}"))
(substitute* "Meta/CMake/common_compile_options.cmake"
(("\\badd_compile_options\\(-Werror\\)") ""))))))
(define cldr-version "42.0.0")
(define cldr-json
(origin
(method url-fetch)
(uri (string-append "https://github.com/unicode-org/cldr-json/releases/download/" cldr-version "/cldr-" cldr-version "-json-modern.zip"))
(sha256 (base32 "1hmdqca0gdx3waafbz2dypika6gd5p7wb6p90ff0bfgvwx9p1n07"))))
(define ucd-version "15.0.0")
(define ucd-emoji-version "15.0")
(define ucd
(origin
(method url-fetch)
(uri (string-append "https://unicode.org/Public/" ucd-version "/ucd/UCD.zip"))
(sha256 (base32 "133inqn33hcfvylmps63yjr6rrqrfq6x7a5hr5fd51z6yc0f9gaz"))))
(define ucd-emoji-test
(origin
(method url-fetch)
(uri (string-append "https://unicode.org/Public/emoji/" ucd-emoji-version "/emoji-test.txt"))
(sha256 (base32 "1nskm3qqb568dlsz54r0ympqbzyf9zhn40lxw5mhk3iqr0xg4ic4"))))
(define tzdb-version "2022f")
(define tzdb
(origin
(method url-fetch)
(uri (string-append "https://data.iana.org/time-zones/releases/tzdata" tzdb-version ".tar.gz"))
(sha256 (base32 "007hgak36scah2fsgf7gkzw2fw5b3jp8mziip5kja8axcwgxg44r"))))
(define ladybird
(package
(name "ladybird")
(version "0")
(synopsis "The Ladybird Web Browser is a browser using the SerenityOS LibWeb engine with a Qt GUI.")
(description synopsis)
(home-page "https://github.com/SerenityOS/ladybird")
(license license:bsd-2)
(source
(origin
(method git-fetch)
(uri
(git-reference
(url "https://github.com/SerenityOS/ladybird")
(commit "7e670a08180c51d474b982f871074c1b60cf49f7")))
(file-name (git-file-name name version))
(sha256 (base32 "1a0mp7cx9wbzfyrkg992sc25wsbw1bxnbw1cfc2hyhm4ksl31a7y"))))
(native-inputs
(list
`("gcc" ,gcc-12)
`("libxkbcommon" ,libxkbcommon)
`("mesa" ,mesa)
`("openssl" ,openssl)
`("qtbase" ,qtbase)
`("qttools" ,qttools)
`("serenity-source" ,serenity-source)
`("cldr-json" ,cldr-json)
`("ucd" ,ucd)
`("ucd-emoji-test" ,ucd-emoji-test)
`("tzdb" ,tzdb)))
(build-system qt-build-system)
(arguments
`(#:configure-flags
(list
(string-append "-DSERENITY_SOURCE_DIR=" (getcwd) "/source/serenity"))
#:out-of-source? #f
#:phases
(modify-phases %standard-phases
(add-before 'patch-source-shebangs 'copy-serenity-source
(lambda* (#:key inputs #:allow-other-keys)
(copy-recursively (assoc-ref inputs "serenity-source") "serenity")))
(add-before 'configure 'copy-data
(lambda* (#:key inputs #:allow-other-keys)
(mkdir-p "CLDR") (mkdir-p "UCD") (mkdir-p "TZDB")
(let ((port (open-file "CLDR/version.txt" "w")))
(display ,cldr-version port)
(close port))
(let ((port (open-file "UCD/version.txt" "w")))
(display ,ucd-version port)
(close port))
(let ((port (open-file "TZDB/version.txt" "w")))
(display ,tzdb-version port)
(close port))
(copy-file (assoc-ref inputs "cldr-json") "CLDR/cldr.zip")
(copy-file (assoc-ref inputs "ucd") "UCD/UCD.zip")
(copy-file (assoc-ref inputs "ucd-emoji-test") "UCD/emoji-test.txt")
(copy-file (assoc-ref inputs "tzdb") "TZDB/tzdb.tar.gz")))
(add-before 'build 'make-libweb-generated-directories
(lambda _
(mkdir-p "_deps/lagom-build/Userland/Libraries/LibWeb/Bindings")
(mkdir-p "_deps/lagom-build/WebContent"))))
; no tests
#:tests? #f))))
ladybird
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment