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

WIP: Move to BinaryProvider build #439

Closed
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
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
*.swp
deps/deps.jl
docs/build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think docs/build shouldn't be removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was removed previously (see below), I just changed the ordering when copying from another .gitignore

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I shouldn't comment when I'm that tired, sorry

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for checking! I shouldn't have reordered it tbh :)

*.jl.*.cov
*.jl.cov
*.jl.mem
.DS_Store
Manifest.toml
/Manifest.toml
/dev/
/deps/*
!/deps/build.jl
docs/build
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ os:
- linux
- osx
julia:
- 0.7
- 1.0
- 1.2
- nightly
# uncomment the following lines to allow failures on nightly julia
# (tests will run but not make your overall status red)
matrix:
allow_failures:
- julia: 1.0
- julia: nightly
notifications:
email: false
addons:
Expand Down
12 changes: 7 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ uuid = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
version = "0.17.0"

[deps]
BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Graphics = "a2bd30eb-e257-5431-a919-1863eab51364"
Homebrew = "d9be37ee-ecc9-5288-90f1-b9ca67657a75"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
WinRPM = "c17dfb99-b4f7-5aad-8812-456da1ad7187"

[compat]
Cairo = "≥ 0.2.2"
Compat = "≥ 0.66.0"
Graphics = "≥ 0.1.0"
julia = "≥ 0.7.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
116 changes: 48 additions & 68 deletions deps/build.jl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,70 +1,50 @@
using BinDeps, Compat

@BinDeps.setup

group = library_group("gtk")

glib = library_dependency("glib", aliases = ["libglib-2.0", "libglib-2.0-0"], group = group)
gobject = library_dependency("gobject", aliases = ["libgobject-2.0", "libgobject-2.0-0"], group = group)
gtk = library_dependency("gtk", aliases = ["libgtk-3", "libgtk-3-0"], group = group)
gdk = library_dependency("gdk", aliases = ["libgdk-3", "libgdk-3-0"], group = group)
# for gtk2 use these two lines instead of the previous two
#gtk = library_dependency("gtk", aliases = ["libgtk-quartz-2.0", "libgtk-win32-2.0-0", "libgtk-x11-2.0"], group = group)
#gdk = library_dependency("gdk", aliases = ["libgdk-quartz-2.0", "libgdk-win32-2.0-0", "libgdk-x11-2.0"], group = group)
gdk_pixbuf = library_dependency("gdk_pixbuf", aliases = ["libgdk_pixbuf-2.0", "libgdk_pixbuf-2.0-0"], group = group)
gio = library_dependency("gio", aliases = ["libgio-2.0", "libgio-2.0-0"], group = group)

deps = [glib, gobject, gtk, gdk, gdk_pixbuf, gio]

if Sys.islinux()
provides(AptGet, "libgtk-3-dev", deps)
provides(Yum, "gtk3", deps)
end

if Sys.iswindows()
using WinRPM
provides(WinRPM.RPM,"libgtk-3-0", [gtk,gdk,gdk_pixbuf,glib,gio], os = :Windows)
provides(WinRPM.RPM,"libgobject-2_0-0", [gobject], os = :Windows)

# install some other quasi-required packages
WinRPM.install([
"glib2-tools","gtk3-tools","gtk2-tools",
"pango-tools","gdk-pixbuf-query-loaders",
"hicolor-icon-theme","tango-icon-theme",
"gnome-icon-theme","gnome-icon-theme-extras",
"gnome-icon-theme-symbolic",];
yes = !isinteractive()) # don't prompt for unattended installs

# compile the schemas
libdir = joinpath(dirname(pathof(WinRPM)), "..", "deps","usr","$(Sys.ARCH)-w64-mingw32","sys-root","mingw","bin")
run(`$libdir/glib-compile-schemas $libdir/../share/glib-2.0/schemas`)
end

if Sys.isapple()
using Homebrew
provides(Homebrew.HB, "gtk+3", [gtk, gdk, gobject], os = :Darwin, onload =
"""
function __init__bindeps__()
if "XDG_DATA_DIRS" in keys(ENV)
ENV["XDG_DATA_DIRS"] *= ":" * joinpath("$(Homebrew.brew_prefix)", "share")
else
ENV["XDG_DATA_DIRS"] = joinpath("$(Homebrew.brew_prefix)", "share")
end
ENV["GDK_PIXBUF_MODULEDIR"] = joinpath("$(Homebrew.brew_prefix)", "lib/gdk-pixbuf-2.0/2.10.0/loaders")
ENV["GDK_PIXBUF_MODULE_FILE"] = joinpath("$(Homebrew.brew_prefix)", "lib/gdk-pixbuf-2.0/2.10.0/loaders.cache")
run(`$(joinpath("$(Homebrew.brew_prefix)", "bin/gdk-pixbuf-query-loaders")) --update-cache`)
end
""")
provides(Homebrew.HB, "glib", [glib, gio], os = :Darwin)
provides(Homebrew.HB, "gdk-pixbuf", gdk_pixbuf, os = :Darwin)
Homebrew.add("adwaita-icon-theme")
using BinaryProvider # requires BinaryProvider 0.3.0 or later

# Parse some basic command-line arguments
const verbose = "--verbose" in ARGS
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))

# These are the two binary objects we care about
products = Product[
LibraryProduct(prefix, ["libz"], :libz),
LibraryProduct(prefix, ["libglib"], :libglib),
LibraryProduct(prefix, ["libgobject"], :gobject),
LibraryProduct(prefix, ["libgio"], :gio),
# Gets to here!
LibraryProduct(prefix, ["libgtk"], :gtk),
LibraryProduct(prefix, ["libgdk"], :gdk),
LibraryProduct(prefix, ["libgdk_pixbuf"], :gdk_pixbuf),

]

dependencies = [
# We need zlib
"https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.4/build_Zlib.v1.2.11.jl",
# We need libffi
"https://github.com/JuliaPackaging/Yggdrasil/releases/download/Libffi-v3.2.1-0/build_Libffi.v3.2.1.jl",
# We need gettext
"https://github.com/JuliaPackaging/Yggdrasil/releases/download/Gettext-v0.19.8-0/build_Gettext.v0.19.8.jl",
# We need pcre
"https://github.com/JuliaPackaging/Yggdrasil/releases/download/PCRE-v8.42-2/build_PCRE.v8.42.0.jl",
# We need iconv
"https://github.com/JuliaPackaging/Yggdrasil/releases/download/Libiconv-v1.15-0/build_Libiconv.v1.15.0.jl",
# We need Glib
"https://github.com/JuliaPackaging/Yggdrasil/releases/download/Glib-v2.59.0%2B0/build_Glib.v2.59.0.jl",


]


for dependency in dependencies
file = joinpath(@__DIR__, basename(dependency))
isfile(file) || download(dependency, file)
# it's a bit faster to run the build in an anonymous module instead of
# starting a new julia process

# Build the dependencies
Mod = @eval module Anon end
Mod.include(file)
end

@BinDeps.install Dict([
(:glib, :libglib),
(:gobject, :libgobject),
(:gtk, :libgtk),
(:gdk, :libgdk),
(:gdk_pixbuf, :libgdk_pixbuf),
(:gio, :libgio),
])
# Finally, write out a deps.jl file
write_deps_file(joinpath(@__DIR__, "deps.jl"), products)
61 changes: 0 additions & 61 deletions deps/ext.jl

This file was deleted.

22 changes: 0 additions & 22 deletions deps/ext_glib.jl

This file was deleted.

10 changes: 8 additions & 2 deletions src/Gtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ module Gtk

using Compat

# Load in `deps.jl`, complaining if it does not exist
const depsjl_path = joinpath(@__DIR__, "..", "deps", "deps.jl")
if !isfile(depsjl_path)
println("Deps path: $depsjl_path")
error("Gtk not installed properly, run `] build Gtk`, restart Julia and try again")
end

const suffix = :Leaf
include("GLib/GLib.jl")
using .GLib
using .GLib.MutableTypes
import .GLib: set_gtk_property!, get_gtk_property, getproperty, FieldRef
import .GLib: set_gtk_property!, get_gtk_property, getproperty, FieldRef
import .GLib:
signal_connect, signal_handler_disconnect,
signal_handler_block, signal_handler_unblock,
Expand Down Expand Up @@ -39,7 +46,6 @@ export GAccessor
include("basic_exports.jl")
include("long_exports.jl")
include("long_leaf_exports.jl")
include(joinpath("..", "deps", "ext.jl"))

if gtk_version == 3
global const libgtk_version = VersionNumber(
Expand Down