Build tools and some fixes

This commit is contained in:
leca 2024-05-03 18:00:03 +03:00
parent d15dc4ff37
commit 6e1a8738e0
11 changed files with 58 additions and 10 deletions

1
AppImage/.DirIcon Symbolic link
View File

@ -0,0 +1 @@
icon.png

2
AppImage/AppRun Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
exec $APPDIR/usr/bin/learn-hieroglyph

BIN
AppImage/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 889 B

View File

@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
Name=Learn Hieroglyph
Exec=learn-hieroglyph
Icon=icon
Categories=Utility;

BIN
AppImage/usr/bin/learn-hieroglyph Executable file

Binary file not shown.

Binary file not shown.

View File

@ -30,6 +30,10 @@ fn main() {
.arg(&path)
.spawn()
.expect("failed to copy schema to dest. dir");
Command::new("glib-compile-schemas")
.arg("resources")
.spawn()
.expect("Could not compile glib schemas. Probably you don't have glib build tools on your system.");
Command::new("glib-compile-schemas")
.arg(path)
.spawn()

18
build_for_windows.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
#This script is intended to help with building for windows systems. Everyting was
#snatched from https://martinber.github.io/gtk-rs.github.io/docs-src/tutorial/cross.
#Before executing, you need to install some libraries.
#Arch linux: yay -S mingw-w64-gtk4
#Other distros: Feeling pity for u :)
#Useful: https://web.archive.org/web/20180719181100/http://win32builder.gnome.org/
if [[ $1 == "" ]]; then
echo "[WARNING] PKG_CONFIG_PATH as a first argument was not defined. Using default value '/usr/i686-w64-mingw32/lib/pkgconfig'"
export PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig
else
echo "[INFO] Setting PKG_CONFIG_PATH to '$1'"
export PKG_CONFIG_PATH=$1
fi
export PKG_CONFIG_ALLOW_CROSS=1
cargo build --target=x86_64-pc-windows-gnu --release

17
pack_appimage.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
if ! command -v appimagetool &> /dev/null
then
echo "No appimage tool installed. Please, install it."
exit 1
fi
cargo build --release
mkdir -p AppImage/usr/bin
mkdir -p AppImage/usr/share/glib-2.0/schemas
cp resources/gschemas.compiled AppImage/usr/share/glib-2.0/schemas/ # Copy settings
cp target/release/learn-hieroglyph AppImage/usr/bin
chmod +x AppImage/AppRun
ARCH=x86_64 appimagetool AppImage learn-hieroglyph.AppImage

View File

@ -1,7 +1,4 @@
/*
TODOS:
4. With incorrect answerd card, it shows hieroglyp, reading ant its translation
*/
#![windows_subsystem = "windows"]
mod db;
mod game;

View File

@ -70,8 +70,6 @@ impl ObjectImpl for MemoryCardsGameScene {
e.set_text("");
}));
}
}
impl MemoryCardsGameScene {
@ -83,8 +81,8 @@ impl MemoryCardsGameScene {
self.card_display.set_reading(card.reading());
self.card_display.set_translation(card.translation());
self.card_display.update_file_for_image();
},
None => { self.obj().show_no_cards_msg() }
}
None => self.obj().show_no_cards_msg(),
}
}
}
@ -114,7 +112,12 @@ fn generate_card() -> Option<CardDisplay> {
None => return None,
};
let generated_card = CardDisplay::new(
&(get_images_store_path() + "/" + &random_card.image_path().unwrap()),
&(get_images_store_path()
+ "/"
+ match &random_card.image_path() {
Some(path) => &path[..],
None => return None,
}),
&random_card.hieroglyph().unwrap(),
Some(&random_card.reading().unwrap()),
&random_card.translation().unwrap(),