summaryrefslogtreecommitdiff
blob: 3d787502b52cea631f9c72aa5bfb906d6c21a3f5 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

DESCRIPTION="Platform independent instrument control for Zurich Instruments devices"
HOMEPAGE="https://www.zhinst.com/labone"
SRC_URI="https://www.zhinst.com/system/files/downloads/files/LabOneLinux64-${PV}.tar.gz"

LICENSE="zi-labone"
SLOT="0"
KEYWORDS="-* ~amd64"
RESTRICT="mirror bindist"
IUSE="minimal"

QA_PREBUILT="*"

RDEPEND=""

S=${WORKDIR}/LabOneLinux64-${PV}

src_install() {
	local instPath=/opt/zi
	local instrDir="LabOne64-${PV}"

	if ! use minimal ; then

		dodir ${instPath}/${instrDir}
		for dir in API DataServer Documentation WebServer release_notes_16.12.txt ; do
			cp -a "$dir" "${D}${instPath}/${instrDir}/" || die
		done

		dosym ../..${instPath}/${instrDir}/DataServer/ziServer /opt/bin/ziServer
		dosym ../..${instPath}/${instrDir}/DataServer/ziDataServer /opt/bin/ziDataServer

		echo "#!/bin/bash" > "${T}/startWebServer" || die
		echo "${instPath}/${instrDir}/WebServer/ziWebServer -r ${instPath}/${instrDir}/WebServer/html --ip 127.0.0.1 --server-port 8004" >> "${T}/startWebServer" || die
		chmod 755 "${T}/startWebServer" || die
		exeinto /opt/bin
		doexe "${T}/startWebServer"
		elog For security reasons the startWebServer script listens on the localhost interface only.
	else

		insinto "${instPath}/${instrDir}/API/C/lib"
		doins API/C/lib/*.so
		insinto "${instPath}/${instrDir}/API/C/include"
		doins API/C/include/*.h

	fi

	dosym "../..${instPath}/${instrDir}/API/C/include/ziAPI.h" "usr/include/ziAPI.h"
	dosym "../..${instPath}/${instrDir}/API/C/lib/libziAPI-linux64.so" "usr/$(get_libdir)/libziAPI-linux64.so"

	# the udev integration

	sed -e 's:/usr/bin/ziServer:/opt/bin/ziServer:g' -i Installer/udev/config || die
	insinto /etc/ziService
	doins Installer/udev/config
	sed -e 's:/usr/bin/ziServer:/opt/bin/ziServer:g' -i Installer/udev/55-zhinst.rules || die
	insinto /lib/udev/rules.d
	doins Installer/udev/55-zhinst.rules
	exeinto /opt/bin
	doexe Installer/udev/ziService

	# just to make sure
	dosym ../../opt/bin/ziService usr/bin/ziService
}

pkg_prerm() {
	if [[ -x /opt/bin/ziService ]]; then
		einfo "Stopping ziService for safe unmerge"
		/opt/bin/ziService stop
	fi
}