summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 72d6d6751d0047db5d76392a05a02666116c659d (plain)
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
# Maintainer: dakataca <馃惉danieldakataca@gmail.com>
# Contributor: Cristophero <cristophero.alvarado@gmail.com>

pkgname='pseint'
pkgver=20230517
pkgrel=1
pkgdesc='A tool for learning programming basis with a simple spanish pseudocode.'
arch=('x86_64')
url='https://sourceforge.net/projects/pseint'
license=('GPL2')
conflicts=("$pkgname-bin")
makedepends=('gendesk')
depends=('wxwidgets-gtk3')
noextract=(creator.psz)
source=("https://netactuate.dl.sourceforge.net/project/$pkgname/$pkgver/$pkgname-src-$pkgver.tgz")
sha256sums=('f3373b0ad0d0f518d72c05504e282cb4fa9d0c9b11f1f7c1a29c4117354ff9e2')  # 'makepkg -g' to generate it.


# Funci贸n 'prepare': Prepara el entorno antes de compilar el paquete.
prepare(){
    cd $pkgname

    # Utilidad 'gendesk' para generar el archivo .desktop.
    gendesk -f -n \
        --pkgname="$pkgname" \
        --pkgdesc="$pkgdesc" \
        --name="$pkgname" \
        --genericname="$pkgname" \
        --comment="$pkgdesc" \
        --exec="$pkgname" \
        --path="/opt/$pkgname" \
        --icon="$pkgname" \
        --categories='Development,Education'
}


# Funci贸n 'pkgver': Devuelve la versi贸n del paquete.
pkgver(){
    cd $pkgname
    cat "bin/version"
}


# Funci贸n 'build': Compila el paquete.
build(){
    cd $pkgname

    # Obtener la versi贸n de wx-config.
    local -r wxconfig_version=$(wx-config --version | sed -E 's/([0-9]\.[0-9])(\.[0-9])*/\1/')

    # Reemplazar la versi贸n de wx-config en los archivos Makefile.
    sed -Ei \
        "s/(--version=)[0-9](\.[0-9])*/\1$wxconfig_version/g ; \
        s,bin(/bin),\1," \
        $srcdir/$pkgname/ps{eval,term,draw{E,3}}/Makefile

    # Compilar el paquete con la opci贸n ARCH=lnx, para la arquitectura linux.
    make ARCH=lnx
}


# Funci贸n 'package': Empaqueta los archivos compilados en el paquete final.
package(){
    cd "$pkgname"

    # Crear ruta de destino transitoria.
    mkdir -p $pkgdir/opt/$pkgname

    # Copiar el contenido compilado a la ruta de destino transitoria.
    cp -rv bin/* $pkgdir/opt/$pkgname

    # Instalar el archivo .desktop en la ubicaci贸n (-t) adecuada.
    install -Dvm644 "$pkgname.desktop" -t "$pkgdir/usr/share/applications/"

    # Instalar el archivo de licencia en la ubicaci贸n adecuada.
    install -Dvm644 license.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

    # Crear un archivo ejecutable en /usr/bin/$pkgname que ejecuta el programa wxPSeInt(pseint).
    install -Dvm755 <(echo -e '#!/usr/bin/env bash\n/opt/pseint/wxPSeInt') $pkgdir/usr/bin/$pkgname
}


## Test
# rm -rf pseint-* src/ pkg/
# makepkg --printsrcinfo > .SRCINFO

## References
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=densify
# https://wiki.archlinux.org/title/Desktop_entries#How_to_use
# https://sourceforge.net/p/pseint/code/ci/master/tree/fuentes.txt
# https://sourceforge.net/p/pseint/code/ci/master/tree/
# https://askubuntu.com/questions/1060601/is-there-a-way-to-create-a-script-and-make-it-executable-in-less-code-than-this#comment1736560_1060642
# https://www.gnu.org/software/bash/manual/html_node/Process-Substitution.html