Skip to content

Commit 1c33500

Browse files
committed
split out __init__ into multiple functions for clarity, and so BinDeps doesn't override it
1 parent 2e901d3 commit 1c33500

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

deps/build.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ end
2020

2121
@windows_only begin
2222
using WinRPM
23-
provides(WinRPM.RPM,"gtk3", [gtk,gdk,gdk_pixbuf,glib,gio], os = :Windows )
23+
provides(WinRPM.RPM,"gtk3", [gtk,gdk,gdk_pixbuf,glib,gio], os = :Windows)
2424
provides(WinRPM.RPM,"libgobject-2_0-0", [gobject], os = :Windows)
2525
end
2626

2727
@osx_only begin
2828
using Homebrew
29-
provides(Homebrew.HB, "gtk+3", [gtk, gdk, gobject], os = :Darwin, onload =
29+
provides(Homebrew.HB, "gtk+3", [gtk, gdk, gobject], os = :Darwin, onload =
3030
"""
31-
function __init__()
31+
function __init__bindeps__()
3232
if "XDG_DATA_DIRS" in ENV
3333
ENV["XDG_DATA_DIRS"] *= ":" * joinpath("$(Homebrew.brew_prefix)", "share")
3434
else
3535
ENV["XDG_DATA_DIRS"] = joinpath("$(Homebrew.brew_prefix)", "share")
3636
end
3737
end
38-
""" )
38+
""")
3939
provides(Homebrew.HB, "glib", [glib, gio], os = :Darwin)
4040
provides(Homebrew.HB, "gdk-pixbuf", gdk_pixbuf, os = :Darwin)
4141
end
@@ -47,4 +47,4 @@ end
4747
:gio => :libgio,
4848
:gobject => :libgobject,
4949
:glib => :libglib
50-
]
50+
]

deps/ext.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const _depspath = joinpath(dirname(@__FILE__), "deps.jl")
44

55
if isfile(_depspath)
66
include(_depspath)
7-
else
7+
else
88
if gtk_version == 3
99
if OS_NAME == :Windows
1010
const libgtk = "libgtk-3-0"

src/GLib/signals.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function g_yield(data)
281281
end
282282

283283
sizeof_gclosure = 0
284-
function __init__()
284+
function __init__gtype__()
285285
ccall((:g_type_init,libgobject),Void,())
286286
global jlref_quark = quark"julia_ref"
287287
global sizeof_gclosure = WORD_SIZE
@@ -291,12 +291,9 @@ function __init__()
291291
closure = ccall((:g_closure_new_simple,libgobject),Ptr{Void},(Int,Ptr{Void}),sizeof_gclosure,C_NULL)
292292
end
293293
ccall((:g_closure_sink,libgobject),Void,(Ptr{Void},),closure)
294+
end
294295

295-
global JuliaClosureMarshal = cfunction(GClosureMarshal, Void,
296-
(Ptr{Void}, Ptr{GValue}, Cuint, Ptr{GValue}, Ptr{Void}, Ptr{Void}))
297-
global exiting = false
298-
atexit(()->global exiting = true)
299-
296+
function __init__gmainloop__()
300297
global uv_sourcefuncs = _GSourceFuncs(
301298
cfunction(uv_prepare,Cint,(Ptr{Void},Ptr{Cint})),
302299
cfunction(uv_check,Cint,(Ptr{Void},)),
@@ -318,3 +315,14 @@ function __init__()
318315
ccall((:g_source_unref,GLib.libglib),Void,(Ptr{Void},),src)
319316
end
320317

318+
function __init__()
319+
if isdefined(GLib,:__init__bindeps__)
320+
GLib.__init__bindeps__()
321+
end
322+
global JuliaClosureMarshal = cfunction(GClosureMarshal, Void,
323+
(Ptr{Void}, Ptr{GValue}, Cuint, Ptr{GValue}, Ptr{Void}, Ptr{Void}))
324+
global exiting = false
325+
atexit(()->global exiting = true)
326+
__init__gtype__()
327+
__init__gmainloop__()
328+
end

0 commit comments

Comments
 (0)