1{ stdenv, fetchurl, pythonFull }:
2
3stdenv.mkDerivation rec {
4 name = "openopc-${version}";
5 version = "1.2.0";
6
7 src = fetchurl {
8 url = "mirror://sourceforge/project/openopc/openopc/${version}/OpenOPC-${version}.source.tar.bz2";
9 sha256 = "0mm77fiipz5zy82l6pr3wk18bfril81milv2rdxr954c4gw5smyd";
10 };
11
12 # There is no setup.py or any other "build system" file in the source archive.
13 installPhase = ''
14 mkdir -p "$out/bin"
15 mkdir -p "$out/share/doc/openopc"
16 mkdir -p "$out/${pythonFull.python.sitePackages}"
17 mkdir -p "$out/libexec/opc"
18
19 cp src/OpenOPC.py "$out/${pythonFull.python.sitePackages}"
20 cp src/opc.py "$out/libexec/opc/"
21
22 cat > "$out/bin/opc" << __EOF__
23 #!${stdenv.shell}
24 export PYTHONPATH="$out/${pythonFull.python.sitePackages}"
25 exec ${pythonFull}/bin/${pythonFull.python.executable} "$out/libexec/opc/opc.py" "\$@"
26 __EOF__
27 chmod a+x "$out/bin/opc"
28
29 cp -R *.txt doc/* "$out/share/doc/openopc/"
30
31 # Copy these MS Windows tools, for reference.
32 cp src/OpenOPCService.py src/SystemHealth.py "$out/libexec/opc/"
33 '';
34
35 meta = with stdenv.lib; {
36 description = "OPC (OLE for Process Control) toolkit designed for use with Python";
37 homepage = http://openopc.sourceforge.net/;
38 # """OpenOPC for Python is freely available under the terms of the GNU GPL.
39 # However, the OpenOPC library module is licensed under the "GPL + linking
40 # exception" license, which generally means that programs written using the
41 # OpenOPC library may be licensed under any terms."""
42 license = licenses.gpl2;
43 platforms = platforms.linux;
44 maintainers = [ maintainers.bjornfor ];
45 };
46}