Adding cards and packaging script.
This commit is contained in:
parent
7c39a44061
commit
904c61ff3f
100
package.pl
Normal file
100
package.pl
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Path::Tiny;
|
||||||
|
use File::pushd qw/pushd/;
|
||||||
|
|
||||||
|
my $destdir = Path::Tiny->tempdir;
|
||||||
|
my $recuento_inner = $destdir->child('recuento');
|
||||||
|
print $recuento_inner.'';
|
||||||
|
$recuento_inner->mkpath;
|
||||||
|
my $resources = $recuento_inner->child('resources');
|
||||||
|
$resources->mkpath;
|
||||||
|
copy_recursive('/usr/x86_64-w64-mingw32/usr/bin/*.{exe,dll,EXE,DLL}', $recuento_inner);
|
||||||
|
copy_recursive('/usr/x86_64-w64-mingw32/usr/share/recuento/', $resources);
|
||||||
|
compile_and_add_launcher ($destdir);
|
||||||
|
make_config ($destdir);
|
||||||
|
make_share ($destdir);
|
||||||
|
|
||||||
|
compress_7z($destdir);
|
||||||
|
create_executable();
|
||||||
|
|
||||||
|
sub create_executable {
|
||||||
|
my $zip = path('recuento.7z');
|
||||||
|
my $config = path('config.txt');
|
||||||
|
my $executable = path('recuento.exe');
|
||||||
|
my $config_txt_contents = <<'EOF';
|
||||||
|
;!@Install@!UTF-8!
|
||||||
|
Title="Recuento"
|
||||||
|
RunProgram="recuento\Recuento.exe"
|
||||||
|
;!@InstallEnd@!
|
||||||
|
EOF
|
||||||
|
$config->spew_utf8($config_txt_contents);
|
||||||
|
open my $fh, '-|', qw@cat /usr/bin/7zS2.sfx@, $zip;
|
||||||
|
binmode $fh, ':raw';
|
||||||
|
my $executable_contents = join '', <$fh>;
|
||||||
|
$executable->spew($executable_contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub make_share {
|
||||||
|
my $recuento = shift;
|
||||||
|
my $share_fonts = $recuento->child('share', 'fonts');
|
||||||
|
my $share_icons = $recuento->child('share', 'icons');
|
||||||
|
my $share_schemas = $recuento->child('share', 'glib-2.0', 'schemas');
|
||||||
|
$share_schemas->mkpath;
|
||||||
|
$share_fonts->mkpath;
|
||||||
|
$share_icons->mkpath;
|
||||||
|
copy_recursive('/usr/x86_64-w64-mingw32/usr/share/fonts/liberation-fonts/', $share_fonts.'');
|
||||||
|
copy_recursive('/usr/x86_64-w64-mingw32/usr/share/icons/Adwaita', $share_icons.'');
|
||||||
|
copy_recursive('/usr/x86_64-w64-mingw32/usr/share/icons/hicolor', $share_icons.'');
|
||||||
|
copy_recursive('/usr/x86_64-w64-mingw32/usr/share/glib-2.0/schemas/*', $share_schemas.'');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub make_config {
|
||||||
|
my $recuento = shift;
|
||||||
|
my $etc_gtk = $recuento->child('etc', 'gtk-4.0');
|
||||||
|
$etc_gtk->mkpath;
|
||||||
|
$etc_gtk->child('settings.ini')->spew(<<'EOF');
|
||||||
|
[Settings]
|
||||||
|
gtk-font-name=LiberationSans 20
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
sub compile_and_add_launcher {
|
||||||
|
my $recuento = shift;
|
||||||
|
my $c_tmp_dir = Path::Tiny->tempdir;
|
||||||
|
my $filename = 'Recuento';
|
||||||
|
my $c = 'Recuento.c';
|
||||||
|
my $c_contents = <<'EOF';
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <windows.h>
|
||||||
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR pCmdLine, int nCmdShow) {
|
||||||
|
char* argument_list[] = { _fullpath(NULL, "recuento\\\\recuento.exe", 3000), NULL };
|
||||||
|
_putenv_s("DATADIR_RECUENTO", "recuento\\\\resources/");
|
||||||
|
_putenv_s("GSETTINGS_SCHEMA_DIR", "share\\\\glib-2.0\\\\schemas");
|
||||||
|
int return_value = execvp(argument_list[0], argument_list);
|
||||||
|
if (return_value == -1)
|
||||||
|
printf ("%s\n", strerror(errno));
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
my $c_file = $c_tmp_dir->child($c);
|
||||||
|
$c_file->spew($c_contents);
|
||||||
|
system qw@/usr/bin/x86_64-w64-mingw32-gcc@, '-Wl,--subsystem,windows',
|
||||||
|
qw@-mwindows@, $c_file, qw@-o@, $recuento->child($filename);
|
||||||
|
}
|
||||||
|
sub copy_recursive {
|
||||||
|
my $source = shift;
|
||||||
|
my $dest = shift;
|
||||||
|
return !!0+system 'cp', '-r', glob($source), $dest;
|
||||||
|
}
|
||||||
|
sub compress_7z {
|
||||||
|
my $destdir = shift;
|
||||||
|
my $zip_output = path($0)->parent->child('recuento.7z')->absolute;
|
||||||
|
$zip_output->remove if -e $zip_output;
|
||||||
|
my $pushd = pushd $destdir;
|
||||||
|
system qw/7z a -t7z -r /,$zip_output, '.';
|
||||||
|
}
|
@ -101,6 +101,12 @@ GLib.List<Gtk.Widget> fill_parties_container(Sqlite.Database db,
|
|||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
var party_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);
|
var party_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);
|
||||||
|
party_box.add_css_class ("card");
|
||||||
|
party_box.margin_bottom = 3;
|
||||||
|
party_box.margin_top = 10;
|
||||||
|
party_box.margin_start = 10;
|
||||||
|
party_box.margin_end = 10;
|
||||||
|
|
||||||
var party_picture = new Gtk.Picture();
|
var party_picture = new Gtk.Picture();
|
||||||
var party_name_widget = new Gtk.Label (party.name);
|
var party_name_widget = new Gtk.Label (party.name);
|
||||||
var adjustment = new Gtk.Adjustment (party.votes, 0, 50000, 1, 1, 1);
|
var adjustment = new Gtk.Adjustment (party.votes, 0, 50000, 1, 1, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user