Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Allow Gtk.jl to be installed on Windows on Julia 1.10. #697

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ docs/build
.DS_Store
Manifest.toml
MutableArtifacts.toml
*.tar.gz

143 changes: 143 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
[[adwaita_icon_theme]]
arch = "i686"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "glibc"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "x86_64"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "glibc"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "aarch64"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "glibc"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "armv6l"
call_abi = "eabihf"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "glibc"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "armv7l"
call_abi = "eabihf"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "glibc"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "powerpc64le"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "glibc"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "i686"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "musl"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "x86_64"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "musl"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "aarch64"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "musl"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "armv6l"
call_abi = "eabihf"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "musl"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "armv7l"
call_abi = "eabihf"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
libc = "musl"
os = "linux"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "x86_64"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
os = "macos"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "aarch64"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
os = "macos"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "x86_64"
git-tree-sha1 = "65eca7c48dea1e32203b205613441ce9506045b4"
os = "freebsd"

[[adwaita_icon_theme.download]]
sha256 = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"
url = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "i686"
git-tree-sha1 = "043d0732f572e66059278f5964e3752f018a5cdf"
os = "windows"

[[adwaita_icon_theme.download]]
sha256 = "b11fe18679624c9db04523f55d085e9de804899a82f4df11ec4f38c217a10e49"
url = "https://github.com/medyan-dev/SmallZarrGroups.jl/releases/download/v0.6.6/copy_symlinks_adwaita_icon_theme.v3.33.92.any.tar.gz"
[[adwaita_icon_theme]]
arch = "x86_64"
git-tree-sha1 = "043d0732f572e66059278f5964e3752f018a5cdf"
os = "windows"

[[adwaita_icon_theme.download]]
sha256 = "b11fe18679624c9db04523f55d085e9de804899a82f4df11ec4f38c217a10e49"
url = "https://github.com/medyan-dev/SmallZarrGroups.jl/releases/download/v0.6.6/copy_symlinks_adwaita_icon_theme.v3.33.92.any.tar.gz"
4 changes: 1 addition & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Gtk"
uuid = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
version = "1.3.0"
version = "1.3.1"

[deps]
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
Expand All @@ -18,7 +18,6 @@ Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Xorg_xkeyboard_config_jll = "33bec58e-1273-512f-9401-5d533626f822"
adwaita_icon_theme_jll = "b437f822-2cd6-5e08-a15c-8bac984d38ee"
gdk_pixbuf_jll = "da03df04-f53b-5353-a52f-6a8b0620ced0"
hicolor_icon_theme_jll = "059c91fe-1bad-52ad-bddd-f7b78713c282"

Expand All @@ -32,7 +31,6 @@ JLLWrappers = "1.4.0"
Reexport = "0.2, 1.0"
Scratch = "1"
Xorg_xkeyboard_config_jll = "2.27.0"
adwaita_icon_theme_jll = "3.33.92"
gdk_pixbuf_jll = "2.38.2"
hicolor_icon_theme_jll = "0.17.0"
julia = "1.6"
Expand Down
6 changes: 6 additions & 0 deletions icon-artifacts/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
2 changes: 2 additions & 0 deletions icon-artifacts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directoy contains code to generate specific icon artifacts required to run Gtk.jl.

77 changes: 77 additions & 0 deletions icon-artifacts/adwaita_icon_theme.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# This script was how the new adwaita_icon_theme artifact was generated.
using Tar: Tar
using Pkg.Artifacts: bind_artifact!, create_artifact, archive_artifact, artifact_path
using Pkg: Pkg, PlatformEngines
using Base.BinaryPlatforms: Platform
using Random: seed!
using CodecZlib: GzipCompressor
using SHA: sha256

seed!(1234)

windows_platforms = [
# Windows
Platform("i686", "windows"),
Platform("x86_64", "windows"),
]

other_platforms = [
# glibc Linuces
Platform("i686", "linux"),
Platform("x86_64", "linux"),
Platform("aarch64", "linux"),
Platform("armv6l", "linux"),
Platform("armv7l", "linux"),
Platform("powerpc64le", "linux"),

# musl Linuces
Platform("i686", "linux"; libc="musl"),
Platform("x86_64", "linux"; libc="musl"),
Platform("aarch64", "linux"; libc="musl"),
Platform("armv6l", "linux"; libc="musl"),
Platform("armv7l", "linux"; libc="musl"),

# BSDs
Platform("x86_64", "macos"),
Platform("aarch64", "macos"),
Platform("x86_64", "freebsd"),
]

# This is the url that the new windows artifact will be available from:
url_to_upload_to = "https://github.com/medyan-dev/SmallZarrGroups.jl/releases/download/v0.6.6/copy_symlinks_adwaita_icon_theme.v3.33.92.any.tar.gz"
windows_tarball = joinpath(@__DIR__, "copy_symlinks_adwaita_icon_theme.v3.33.92.any.tar.gz")

# This is the url of the source artifact:
url_src = "https://github.com/JuliaBinaryWrappers/adwaita_icon_theme_jll.jl/releases/download/adwaita_icon_theme-v3.33.92+4/adwaita_icon_theme.v3.33.92.any.tar.gz"
tree_hash_src = Base.SHA1("65eca7c48dea1e32203b205613441ce9506045b4")
tar_sha256_src = "f50f3c85710f7dfbd6959bfaa6cc3a940195cd09dadddefb3b5ae9a2f97adad3"

# This is the path to the Artifacts.toml we will manipulate
artifact_toml = joinpath(@__DIR__, "../Artifacts.toml")

for p in other_platforms
bind_artifact!(artifact_toml, "adwaita_icon_theme", tree_hash_src;
platform=p,
force=true,
download_info=[(url_src, tar_sha256_src)],
)
end

# Now copy symlinks to allow the artifact to be installed on windows
tree_hash_windows = create_artifact() do dir
Tar.extract(`$(PlatformEngines.exe7z()) x $(download(url_src)) -so`, dir;
copy_symlinks=true,
)
end
tar_tempfile = Tar.create(artifact_path(tree_hash_windows); portable=true)
tarball_data = transcode(GzipCompressor, read(tar_tempfile))
tar_sha256_windows = bytes2hex(sha256(tarball_data))
write(windows_tarball, tarball_data)

for p in windows_platforms
bind_artifact!(artifact_toml, "adwaita_icon_theme", tree_hash_windows;
platform=p,
force=true,
download_info=[(url_to_upload_to, tar_sha256_windows)],
)
end
4 changes: 2 additions & 2 deletions src/Gtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if isdefined(Base, :Experimental) && isdefined(Base.Experimental, Symbol("@optle
end

# Import binary definitions
using GTK3_jll, Glib_jll, Xorg_xkeyboard_config_jll, gdk_pixbuf_jll, adwaita_icon_theme_jll, hicolor_icon_theme_jll
using GTK3_jll, Glib_jll, Xorg_xkeyboard_config_jll, gdk_pixbuf_jll, hicolor_icon_theme_jll
using Librsvg_jll
using JLLWrappers
using Pkg.Artifacts, Scratch
Expand Down Expand Up @@ -81,7 +81,7 @@ function __init__()

# Set XDG_DATA_DIRS so that Gtk can find its icons and schemas
ENV["XDG_DATA_DIRS"] = join(filter(x -> x !== nothing, [
dirname(adwaita_icons_dir),
joinpath(artifact"adwaita_icon_theme", "share"),
dirname(hicolor_icons_dir),
joinpath(dirname(GTK3_jll.libgdk3_path::String), "..", "share"),
get(ENV, "XDG_DATA_DIRS", nothing)::Union{String,Nothing},
Expand Down
Loading