summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9c3e22306ab18639a5c80487ba9a0777dc2eea4d (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
# Maintainer: Philip Johansson <philipphuket at gmail dotcom>
pkgname=tuidoku-git
_pkgname=tuidoku
pkgver=r230.7a7dcfe
pkgrel=1
pkgdesc="Play, solve and generate sudoku puzzles in the console"
arch=('x86_64')
url="https://github.com/flyingpeakock/tuidoku"
license=('MIT')
depends=(ncurses git ninja)
makedepends=(gcc cmake)
provides=("tuidoku")
replaces=("console_sudoku")
source=("git+https://github.com/flyingpeakock/tuidoku.git")
noextract=("${source[@]##*/}")
md5sums=('SKIP')

pkgver() {
    cd "$_pkgname"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    # This package provides a mechanism to edit the file
    # config.h before installation.

    if [ -e "$BUILDDIR/config.h" ]
    then
        msg='Configuration found in build directory. '
        msg+='Applying custom configuration.'
        warning "$msg"
        cp "$BUILDDIR/config.h" "$srcdir/tuidoku/src/config.h"
        if [ -e "$srcdir/tuidoku-bin" ]
        then
            rm "$srcdir/tuidoku-bin"
        fi
    else
        msg='This package can be configured by editing config.h '
        msg+='Documentation can be found in the comments. '
        msg+='Sometimes changes are made to the config that '
        msg+='are required for building. If a build fails remove the '
        msg+='old config.h file.'
        warning "$msg"
        cp "$_pkgname/src/config.h" "$BUILDDIR/"
    fi
}

build() {
	    #cd "$srcdir/$_pkgname"
        #g++ -Ofast -pthread ./tuidoku/src/*.cpp -lncursesw -o tuidoku-bin
        cmake --no-warn-unused-cli -B build -S "$_pkgname"
        cmake --build build --config Release --target all
}

package() {
        #install -Dm755 tuidoku-bin $pkgdir/usr/bin/tuidoku
        install -Dm755 build/$_pkgname $pkgdir/usr/bin/$_pkgname
        install -Dm644 $srcdir/$_pkgname/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}