summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 01da60389a9ba5eb93d72ef03c289e0387014804 (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
pkgname=openwsman
pkgver=2.7.2
pkgrel=1.2
pkgdesc="Opensource Implementation of WS-Management"
arch=('i686' 'x86_64')
url="https://$pkgname.github.io/"
license=('custom:BSD')
depends=('curl' 'libxml2' 'openssl' 'sblim-sfcc')
makedepends=('cmake>=3.13' 'swig'
             'perl'
             'python' 'python-distutils-extra'
             'ruby' 'rubygems' 'ruby-docs' 'ruby-rdoc')
optdepends=('perl: for perl bindings'
            'python: for python bindings'
            'ruby: for ruby bindings')
backup=("etc/$pkgname/$pkgname.conf"
        "etc/$pkgname/${pkgname}_client.conf"
        "etc/$pkgname/ssleay.cnf"
        "etc/pam.d/$pkgname")
source=("https://github.com/Openwsman/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('f916b20956a64426c60a34fa2eaf2c8a13c7047ea2d2585329a6f33e00113be1')

build() {
	cd "$pkgname-$pkgver"

	cmake -B build \
	      -DCMAKE_BUILD_TYPE=Release \
	      -DCMAKE_C_FLAGS_RELEASE='-DNDEBUG' \
	      -DCMAKE_CXX_FLAGS_RELEASE='-DNDEBUG' \
	      -DCMAKE_INSTALL_PREFIX=/usr \
	      -DPACKAGE_ARCHITECTURE=$CARCH \
	      -DLIB=lib \
	      -DBUILD_PYTHON=OFF \
	      -DBUILD_PYTHON3=ON \
	      -DBUILD_RUBY_GEM=OFF \
	      -DBUILD_JAVA=OFF

	make -C build
}

# TODO: find out why tests fail for python/perl/ruby bindings
#       and report a bug upstream if needed
check() {
	cd "$pkgname-$pkgver"

	 make -n -C build ARGS="-V" test
}

_perl_depends() {
# template start; name=perl-binary-module-dependency; version=1;
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
	_perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
	_perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')
	depends+=("perl>=$_perlver_min" "perl<$_perlver_max")
fi
# template end;
}

package() {
	cd "$pkgname-$pkgver"

	make -C build DESTDIR="$pkgdir/" install

	mv "$pkgdir/usr/sbin/"* "$pkgdir/usr/bin"
	rmdir "$pkgdir/usr/sbin/"

	install -Dp -m644 build/package/"$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
	install -Dp -m644 package/"$pkgname.firewalld"     "$pkgdir/usr/lib/firewalld/services/$pkgname.xml"

	mkdir -p "$pkgdir/usr/share/doc/$pkgname"
	cp -Rp build/bindings/ruby/html/ "$pkgdir/usr/share/doc/$pkgname/rdoc"

	install -Dp -m644 COPYING   "$pkgdir/usr/share/licenses/$pkgname/COPYING"
	install -Dp -m644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"

	install -Dp -m644 AUTHORS   "$pkgdir/usr/share/doc/$pkgname/AUTHORS"
	install -Dp -m644 ChangeLog "$pkgdir/usr/share/doc/$pkgname/ChangeLog"

	find "$pkgdir" -name '.packlist' -delete
	find "$pkgdir" -name '*.pod' -delete
    _perl_depends
}

# vim: set ft=sh ts=4 sw=4 noet: