summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8d0f73343c42e3325fe53f213c25118ce016e09d (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
# Maintainer: Yen Chi Hsuan <yan12125 at gmail.com>
_pkgname=SimpleITK
pkgname=simpleitk
pkgver=1.0.0
_pypkgver=1.0.0
pkgrel=5
pkgdesc="A simplified layer built on top of ITK, intended to facilitate its use in rapid prototyping, education, interpreted languages."
arch=('i686' 'x86_64')
url="http://www.simpleitk.org/"
license=('Apache')
depends=('gcc-libs' 'insight-toolkit>=4.11.0')
makedepends=(
    'clang' 'cmake' 'git' 'swig'
    'java-environment'
    'lua51'
    'mono'
    'python' 'python-pip' 'python-virtualenv' 'python-numpy'
    'r'
    'ruby'
    'tcl' 'tk')
optdepends=(
    'java-runtime: Java bindings'
    'lua51: Lua bindings'
    'mono: C# bindings'
    'python: Python bindings'
    'python-numpy: Python bindings'
    'r: R bindings'
    'ruby: Ruby bindings'
    'tcl: Tcl/TK bindings'
    'tk: Tcl/TK bindings'
)
source=(
    "git+https://github.com/$_pkgname/$_pkgname#tag=v$pkgver"
    'Rlib.patch'
    'lua51.patch'
)
md5sums=('SKIP'
         '2888336abcbb122a49cb5817ac98f36c'
         'a25fe3562664dbef433a3f2cc20d6c39')

prepare() {
    cd "$_pkgname"

    mkdir -p build

    patch -Np1 -i ../Rlib.patch
    patch -Np1 -i ../lua51.patch
}

build() {
    cd "$_pkgname/build"

    CC=clang CXX=clang++ \
    cmake \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_SKIP_RPATH:BOOL=ON \
        -DBUILD_SHARED_LIBS:BOOL=ON \
        -DBUILD_TESTING:BOOL=OFF \
        -DBUILD_EXAMPLES:BOOL=OFF \
        -DSimpleITK_PYTHON_WHEEL:BOOL=ON \
        -DWRAP_JAVA:BOOL=ON \
        ..

    make all PythonVirtualEnv dist
}

package() {
    _builddir="$srcdir/$_pkgname/build"

    cd $_builddir

    make DESTDIR="$pkgdir/" install

    pip install --root="$pkgdir/" --ignore-installed \
        "$_builddir/Wrapping/Python/dist/$_pkgname-$_pypkgver"*"-linux_$CARCH.whl"

    install -d -Dm755 "$pkgdir/usr/lib/lua/5.1/"
    install -Dm755 "$_builddir/Wrapping/Lua/lib/$_pkgname.so" "$pkgdir/usr/lib/lua/5.1/$_pkgname.so"
    install -Dm755 "$_builddir/Wrapping/Tcl/bin/SimpleITKTclsh" "$pkgdir/usr/bin/SimpleITKTclsh"
    install -Dm755 "$_builddir/Wrapping/CSharp/CSharpBinaries/libSimpleITKCSharpNative.so" "$pkgdir/usr/lib/libSimpleITKCSharpNative.so"
    install -Dm755 "$_builddir/Wrapping/CSharp/CSharpBinaries/SimpleITKCSharpManaged.dll" "$pkgdir/usr/lib/SimpleITKCSharpManaged.dll"

    install -d -Dm755 "$pkgdir/usr/lib/R/library/"
    cp -dr --no-preserve=ownership "$_builddir/Wrapping/R/Packaging/$_pkgname" "$pkgdir/usr/lib/R/library/"

    install -d -Dm755 "$pkgdir/usr/share/java/SimpleITK/"
    cp -dr --no-preserve=ownership "$_builddir/Wrapping/Java/dist/SimpleITK-$pkgver"*/* "$pkgdir/usr/share/java/SimpleITK/"
}