Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fetch .dll files when installing on windows
Incomplete: still need to figure out where to host .dll files.
  • Loading branch information
retupmoca committed Mar 24, 2015
1 parent 8b2c996 commit 9c14014
Show file tree
Hide file tree
Showing 5 changed files with 419 additions and 78 deletions.
60 changes: 60 additions & 0 deletions Build.pm
@@ -0,0 +1,60 @@
use Panda::Builder;

use Shell::Command;
use LWP::Simple;
use NativeCall;

# test sub for system library
our sub zlibVersion() returns Str is encoded('ascii') is native('zlib1.dll') is export { * }

class Build is Panda::Builder {
method build($workdir) {
my $need-copy = False;

# we only have .dll files bundled. Non-windows is assumed to have openssl already
if $*DISTRO.is-win {
#zlibVersion();
#CATCH {
# default {
$need-copy = True;
# }
#}
}

if $need-copy {
say 'No system gtk library detected. Installing bundled version.';
mkdir($workdir ~ '\blib\lib\GTK');
my @files = ("libatk-1.0-0.dll",
"libcairo-2.dll",
"libcairo-gobject-2.dll",
"libffi-6.dll",
"libfontconfig-1.dll",
"libfreetype-6.dll",
"libgdk-3-0.dll",
"libgdk_pixbuf-2.0-0.dll",
"libgio-2.0-0.dll",
"libglib-2.0-0.dll",
"libgmodule-2.0-0.dll",
"libgobject-2.0-0.dll",
"libgtk-3-0.dll",
"libiconv-2.dll",
"libintl-8.dll",
"liblzma-5.dll",
"libpango-1.0-0.dll",
"libpangocairo-1.0-0.dll",
"libpangoft2-1.0-0.dll",
"libpangowin32-1.0-0.dll",
"libpixman-1-0.dll",
"libpng15-15.dll",
"libxml2-2.dll",
"zlib1.dll");
for @files {
my $blob = LWP::Simple.get('http://url/goes/here/' ~ $_);
spurt($workdir ~ '\blib\lib\GTK\\' ~ $_, $blob);
}
}
else {
say 'Found system gtk library.';
}
}
}
2 changes: 1 addition & 1 deletion META.info
Expand Up @@ -2,7 +2,7 @@
"name" : "GTK::Simple",
"version" : "*",
"description" : "Simple GTK 3 binding using NativeCall",
"depends" : [ ],
"depends" : [ "LWP::Simple" ],
"repo-type" : "git",
"source-url" : "git://github.com/perl6/gtk-simple.git"
}
22 changes: 6 additions & 16 deletions lib/GTK/GDK.pm6
@@ -1,14 +1,4 @@
my Str $gtklib;
my Str $gdklib;
BEGIN {
if $*VM.config<dll> ~~ /dll/ {
$gtklib = 'libgtk-3-0';
$gdklib = 'libgdk-3-0';
} else {
$gtklib = 'libgtk-3';
$gdklib = 'libgdk-3';
}
}
use GTK::NativeLib;
use NativeCall;

class GdkWindow is repr('CPointer') { }
Expand Down Expand Up @@ -42,18 +32,18 @@ constant carrayuint16 := CArray[uint16];

sub gtk_widget_get_window(OpaquePointer $window)
returns GdkWindow
is native($gtklib)
is native(&gtk-lib)
is export
{*}

sub gdk_window_get_events(GdkWindow $window)
returns int
is native($gdklib)
is native(&gdk-lib)
is export
{*}

sub gdk_window_set_events(GdkWindow $window, int $eventmask)
is native($gdklib)
is native(&gdk-lib)
is export
{*}

Expand All @@ -62,11 +52,11 @@ sub gdk_window_set_events(GdkWindow $window, int $eventmask)
class GdkEvent is repr('CPointer') { ... }

sub gdk_event_get_keycode(GdkEvent $event, carrayuint16 $keycode)
is native($gdklib)
is native(&gdk-lib)
{*}

sub gdk_event_get_keyval(GdkEvent $event, carrayuint16 $keycode)
is native($gdklib)
is native(&gdk-lib)
{*}

class GdkEvent is repr('CPointer') {
Expand Down

0 comments on commit 9c14014

Please sign in to comment.