File: app

package info (click to toggle)
minder 2.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,624 kB
  • sloc: xml: 799; sh: 104; python: 87; ansic: 78; makefile: 5; tcl: 4
file content (122 lines) | stat: -rwxr-xr-x 3,321 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash

arg=$1

function initialize {
    meson setup build --prefix=/usr
    result=$?

    if [ $result -gt 0 ]; then
        echo "Unable to initialize, please review log"
        exit 1
    fi

    cd build

    ninja

    result=$?

    if [ $result -gt 0 ]; then
        echo "Unable to build project, please review log"
        exit 2
    fi
}

function test {
    initialize

    export DISPLAY=:0
    tests/minder-regress
    result=$?

    export DISPLAY=":0.0"

    echo ""
    if [ $result -gt 0 ]; then
        echo "Failed testing"
        exit 100
    fi

    echo "Tests passed!"
}

case $1 in
"clean")
    sudo rm -rf ./build
    ;;
"generate-i18n")
    grep -rc _\( * | grep ^src | grep -v :0 | cut -d : -f 1 | sort -o po/POTFILES
    initialize
    ninja com.github.phase1geo.minder-pot
    ninja com.github.phase1geo.minder-update-po
    ninja extra-pot
    ninja extra-update-po
    cp data/* ../data
    ;;
"install")
    initialize
    sudo ninja install
    ;;
"install-deps")
    output=$((dpkg-checkbuilddeps ) 2>&1)
    result=$?

    if [ $result -eq 0 ]; then
        echo "All dependencies are installed"
        exit 0
    fi

    replace="sudo apt install"
    pattern="(\([>=<0-9. ]+\))+"
    sudo_replace=${output/dpkg-checkbuilddeps: error: Unmet build dependencies:/$replace}
    command=$(sed -r -e "s/$pattern//g" <<< "$sudo_replace")
    
    $command
    ;;
"run")
    initialize
    ./com.github.phase1geo.minder "${@:2}"
    ;;
"run-flatpak")
    flatpak run com.github.phase1geo.minder "${@:2}"
    ;;
"debug")
    initialize
    # G_DEBUG=fatal-criticals gdb --args ./com.github.phase1geo.minder "${@:2}"
    G_DEBUG=fatal-warnings gdb --args ./com.github.phase1geo.minder "${@:2}"
    ;;
"flatpak-debug")
    echo "Run command at prompt: G_DEBUG=fatal-criticals gdb /app/bin/com.github.phase1geo.minder"
    flatpak run --devel --command=sh com.github.phase1geo.minder
    ;;
"test")
    test
    ;;
"uninstall")
    initialize
    sudo ninja uninstall
    ;;
"elementary")
    flatpak-builder --user --install --force-clean ../build-minder-elementary elementary/com.github.phase1geo.minder.yml
    flatpak install --user --reinstall --assumeyes "$(pwd)/.flatpak-builder/cache" com.github.phase1geo.minder.Debug
    ;;
"flathub")
    flatpak-builder --user --install --force-clean ../build-minder-flathub flathub/com.github.phase1geo.minder.yml
    flatpak install --user --reinstall --assumeyes "$(pwd)/.flatpak-builder/cache" com.github.phase1geo.minder.Debug
    ;;
*)
    echo "Usage:"
    echo "  ./app [OPTION]"
    echo ""
    echo "Options:"
    echo "  clean             Removes build directories (can require sudo)"
    echo "  generate-i18n     Generates .pot and .po files for i18n (multi-language support)"
    echo "  install           Builds and installs application to the system (requires sudo)"
    echo "  install-deps      Installs missing build dependencies"
    echo "  run               Builds and runs the application (must run install once before successive calls to this command)"
    echo "  test              Builds and runs testing for the application"
    echo "  uninstall         Removes the application from the system (requires sudo)"
    echo "  flatpak           Builds and installs the Flatpak version of the application"
    ;;
esac