Update readme.txt
This commit is contained in:
parent
dcfe2d2068
commit
fb6183b265
161
readme.txt
161
readme.txt
@ -1 +1,160 @@
|
|||||||
CPAN_OPTS="-j12 -T" PERL_LOCAL_LIB_ROOT="$(realpath perl)" PERL_MB_OPT="--install_base \"$(realpath perl)\"" PERL_MM_OPT="INSTALL_BASE=$(realpath perl)" LANG="English_United Kingdom.1252" WINEDEBUG=-all LIBRARY_PATH="$(realpath c/bin);$(realpath ./)" WINEPATH="$(realpath c/bin/);$(realpath perl/bin)" PKG_CONFIG_PATH=$(realpath lib/pkgconfig/ ) CPATH="$(realpath lib/include/glib-2.0);$(realpath lib/include/gobject-introspection-1.0)" PERL5LIB="$(realpath perl/lib/perl5/MSWin32-x64-multi-thread/);$(realpath perl/lib);$(realpath perl/vendor/lib/);$(realpath perl/site/lib/)" wine perl.exe -MCPAN -e 'install "Glib::Object::Introspection"'
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use v5.38.1;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Path::Tiny;
|
||||||
|
use File::pushd;
|
||||||
|
|
||||||
|
use feature 'signatures';
|
||||||
|
|
||||||
|
my @dlls = (
|
||||||
|
glob('/usr/x86_64-w64-mingw32/usr/bin/*'),
|
||||||
|
glob('/usr/x86_64-w64-mingw32/usr/lib/*')
|
||||||
|
);
|
||||||
|
my $strawberry_zip = path('strawberry-perl-5.38.2.2-64bit-portable.zip');
|
||||||
|
my @typelibs =
|
||||||
|
glob('/usr/x86_64-w64-mingw32/usr/lib/girepository-1.0/*.typelib');
|
||||||
|
my @includes = (
|
||||||
|
glob('/usr/x86_64-w64-mingw32/usr/include/*'),
|
||||||
|
'/usr/x86_64-w64-mingw32/usr/lib/glib-2.0/include/glibconfig.h'
|
||||||
|
);
|
||||||
|
my @pkgconfigs = glob('/usr/x86_64-w64-mingw32/usr/lib/pkgconfig/*.pc');
|
||||||
|
|
||||||
|
# my $destdir = Path::Tiny->tempdir;
|
||||||
|
my $destdir = path('__gtk_install__')->absolute;
|
||||||
|
|
||||||
|
%ENV = (
|
||||||
|
PERL_LOCAL_LIB_ROOT => $destdir->child('perl'),
|
||||||
|
PERL_MB_OPT => "--install_base \"@{[$destdir->child('perl')]}\"",
|
||||||
|
PERL_MM_OPT => "INSTALL_BASE=@{[$destdir->child('perl')]}",
|
||||||
|
LANG => "C.utf8",
|
||||||
|
PKG_CONFIG_PATH => $destdir->child('lib/pkgconfig'),
|
||||||
|
LIBRARY_PATH => "@{[$destdir->child('c/bin')]};@{[$destdir->child('.')]}",
|
||||||
|
CPATH => "@{[$destdir->child('lib/include/glib-2.0')]};"
|
||||||
|
. "@{[$destdir->child('lib/include/gobject-introspection-1.0')]};"
|
||||||
|
. "@{[$destdir->child('lib/include/')]}",
|
||||||
|
PERL5LIB =>
|
||||||
|
"@{[$destdir->child('perl/lib/perl5/MSWin32-x64-multi-thread')]};"
|
||||||
|
. "@{[$destdir->child('perl/lib')]};"
|
||||||
|
. "@{[$destdir->child('perl/lib/perl5')]};"
|
||||||
|
. "@{[$destdir->child('perl/vendor/lib')]};@{[$destdir->child('perl/site/lib/')]}",
|
||||||
|
GI_TYPELIB_PATH => $destdir->child('lib/typelib'),
|
||||||
|
WINEPATH =>
|
||||||
|
"@{[$destdir->child('c/bin')]};@{[$destdir->child('perl/bin')]}",
|
||||||
|
WINEPREFIX => $destdir->child('.wine'),
|
||||||
|
WINEDEBUG => '-all',
|
||||||
|
);
|
||||||
|
|
||||||
|
system 'unzip', '-d', $destdir, $strawberry_zip;
|
||||||
|
|
||||||
|
system 'cp', '-r', @dlls, $destdir->child('c/bin');
|
||||||
|
system( qw/mkdir -pv/, $destdir->child('lib/include') );
|
||||||
|
system( qw/mkdir -pv/, $destdir->child('lib/typelib') );
|
||||||
|
system( qw/mkdir -pv/, $destdir->child('lib/pkgconfig') );
|
||||||
|
system 'cp', '-r', @includes, $destdir->child('lib/include');
|
||||||
|
system 'cp', @typelibs, $destdir->child('lib/typelib');
|
||||||
|
system 'cp', @pkgconfigs, $destdir->child('lib/pkgconfig');
|
||||||
|
|
||||||
|
{
|
||||||
|
my $pushd = pushd $destdir;
|
||||||
|
execute_wine(
|
||||||
|
qw{perl},
|
||||||
|
$destdir->child('perl/bin/cpan.bat'),
|
||||||
|
qw{-T Glib::Object::Introspection}
|
||||||
|
);
|
||||||
|
execute_wine(
|
||||||
|
qw{perl},
|
||||||
|
$destdir->child('perl/bin/cpan.bat'),
|
||||||
|
qw{-T Glib::IO}
|
||||||
|
);
|
||||||
|
my $setup_env_file_contents = <<'EOF';
|
||||||
|
use v5.38.0;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
use Path::Tiny;
|
||||||
|
my $destdir = path(__FILE__)->parent->absolute;
|
||||||
|
|
||||||
|
%ENV = (
|
||||||
|
PERL_LOCAL_LIB_ROOT => $destdir->child('perl'),
|
||||||
|
PERL_MB_OPT => "--install_base \"@{[$destdir->child('perl')]}\"",
|
||||||
|
PERL_MM_OPT => "INSTALL_BASE=@{[$destdir->child('perl')]}",
|
||||||
|
LANG => "C.utf8",
|
||||||
|
PKG_CONFIG_PATH => $destdir->child('lib/pkgconfig'),
|
||||||
|
LIBRARY_PATH => "@{[$destdir->child('c/bin')]};@{[$destdir->child('.')]}",
|
||||||
|
CPATH => "@{[$destdir->child('lib/include/glib-2.0')]};"
|
||||||
|
. "@{[$destdir->child('lib/include/gobject-introspection-1.0')]};"
|
||||||
|
. "@{[$destdir->child('lib/include/')]}",
|
||||||
|
PERL5LIB =>
|
||||||
|
"@{[$destdir->child('perl/lib/perl5/MSWin32-x64-multi-thread')]};"
|
||||||
|
. "@{[$destdir->child('perl/lib')]};"
|
||||||
|
. "@{[$destdir->child('perl/lib/perl5')]};"
|
||||||
|
. "@{[$destdir->child('perl/vendor/lib')]};@{[$destdir->child('perl/site/lib/')]}",
|
||||||
|
GI_TYPELIB_PATH => $destdir->child('lib/typelib'),
|
||||||
|
PATH =>
|
||||||
|
"@{[$destdir->child('c/bin')]};@{[$destdir->child('perl/bin')]}",
|
||||||
|
);
|
||||||
|
|
||||||
|
exec 'wperl.exe', $destdir->child('start.pl');
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $start_c_file_contents = <<'EOF';
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return execl( "perl/bin/wperl.exe", "wperl.exe", "-Iperl/lib", "setup_env.pl", NULL );
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $start_pl_file_contents = <<'EOF';
|
||||||
|
use v5.38.1;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Glib::IO;
|
||||||
|
use Glib::Object::Introspection;
|
||||||
|
|
||||||
|
Glib::Object::Introspection->setup(
|
||||||
|
basename => 'Gtk',
|
||||||
|
version => '4.0',
|
||||||
|
package => 'Gtk',
|
||||||
|
);
|
||||||
|
|
||||||
|
my $app = Gtk::Application->new('com.example.App', 'default-flags');
|
||||||
|
|
||||||
|
$app->signal_connect(activate => sub {
|
||||||
|
my $win = Gtk::ApplicationWindow->new($app);
|
||||||
|
$win->set_title('hola');
|
||||||
|
$win->present;
|
||||||
|
});
|
||||||
|
$app->run();
|
||||||
|
EOF
|
||||||
|
|
||||||
|
$destdir->child('start.c')->spew_raw($start_c_file_contents);
|
||||||
|
$destdir->child('start.pl')->spew_raw($start_pl_file_contents);
|
||||||
|
$destdir->child('setup_env.pl')->spew_raw($setup_env_file_contents);
|
||||||
|
execute('rm', $destdir->child('start.exe'));
|
||||||
|
execute(
|
||||||
|
qw{/usr/bin/x86_64-w64-mingw32-gcc -mwindows -o},
|
||||||
|
$destdir->child('start.exe'),
|
||||||
|
$destdir->child('start.c'), '-Wl,--subsystem,windows',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub execute(@command) {
|
||||||
|
print join( ' ', @command ) . "\n";
|
||||||
|
if ( system @command ) {
|
||||||
|
die "Command failed @{[join ' ', @command]}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub execute_wine(@args) {
|
||||||
|
my @command = ( 'wine', @args );
|
||||||
|
execute(@command);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user