summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 00800d946f9f7c0a32c7922262a29d19f176947c (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
# Maintainer: Score_Under <seejay.11@gmail.com>
_pkgname=ksm_preload
pkgname=$_pkgname-git
pkgver=0.10.9.r459df0e
pkgrel=3
pkgdesc='Library which allows legacy applications to use Kernel Same-page Merging'
url=http://vleu.net/ksm_preload/
arch=(i686 x86_64)
license=(GPL3)
source=("git+https://github.com/unbrice/$_pkgname.git"
        ksm-wrapper)
optdepends=('sh: ksm-wrapper script')
makedepends=(cmake git)
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
sha256sums=('SKIP'
            '8f02470b27c1678ad6041e8c6d3d3bac218c54b14cd306d921e806464b4ca5bd')

cdgit() { cd -- "$_pkgname"; }

pkgver() {
    cdgit
    local version="$(git describe --always --match 'v*.*')"
    version=${version#v}
    version=${version//-/.}
    version=${version/.g/.r}
    printf '%s\n' "$version"
}

prepare() {
    cdgit

    # Use (/usr)/lib rather than (/usr)/share/ksm_preload for native
    # libraries, because /usr/share is supposed to be arch-independent...
    # This will still need a little hacking of ksm-wrapper to get it
    # working with lib32 programs too.
    sed -i.orig 's.\(LIBRARY DESTINATION\) share/ksm_preload.\1 lib/.g' CMakeLists.txt
}

build() {
    cdgit
    cmake -D CMAKE_INSTALL_PREFIX=/usr .
    make
}

package() {
    cdgit
    make install DESTDIR="$pkgdir"

    # Install replacement ksm-wrapper afterwards
    # The original is unnecessarily complex and is full of silly mistakes.
    # I will one day get around to poking the author about that...
    install -m755 -Dt "$pkgdir/usr/bin" ../ksm-wrapper
}