Update generate_folder.pl

This commit is contained in:
sergiotarxz 2024-02-26 22:50:15 +01:00
parent fb6183b265
commit a77289d930

View File

@ -10,6 +10,7 @@ use File::pushd;
use feature 'signatures';
my @dlls = (
glob('/usr/x86_64-w64-mingw32/usr/bin/*'),
glob('/usr/x86_64-w64-mingw32/usr/lib/*')
@ -100,14 +101,14 @@ my $destdir = path(__FILE__)->parent->absolute;
"@{[$destdir->child('c/bin')]};@{[$destdir->child('perl/bin')]}",
);
exec 'wperl.exe', $destdir->child('start.pl');
exec 'perl/bin/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 );
return execl( "perl/bin/wperl.exe", "wperl.exe", "-Iperl/lib", "setup_env.pl", (char *)NULL );
}
EOF
@ -139,12 +140,18 @@ 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('rm', '-f', $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',
);
execute( 'rm', '-r', $destdir->child('.wine'));
execute( 'find', $destdir, '-name', '*.h', '-delete');
execute( 'find', $destdir, '-name', '*.a', '-delete');
execute( 'find', $destdir, '-name', '*.cmake', '-delete');
execute( 'find', $destdir, '-name', '*.idl', '-delete');
execute( 'find', $destdir, '-name', '*.rst', '-delete');
}
sub execute(@command) {