summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 20d0d8a0d92c957afebe7aa2b2313815cb59eb32 (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
# Maintainer: watasuke <watasuke102@gmail.com>
_pkgname=openplc-editor
pkgname="${_pkgname}-git"
pkgver=r184.f772039
pkgrel=2
pkgdesc="OpenPLC editor"
arch=("x86_64")
url="https://github.com/thiagoralves/OpenPLC_Editor"
source=("git+${url}.git")
license=("GPL2")
md5sums=("SKIP")
makedepends=("git")
depends=("python39")

pkgver() {
  cd "${srcdir}/OpenPLC_Editor"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "${srcdir}/OpenPLC_Editor"
  cd matiec
  autoreconf -i
  ./configure --prefix="${pkgdir}" CXXFLAGS="-std=c++03"
  make -s
  cp ./iec2c ../editor/arduino/bin/
}

prepare() {
  mkdir -p "${srcdir}/OpenPLC_Editor/.venv"
  python3.8 -m venv "${srcdir}/OpenPLC_Editor/.venv"
  "${srcdir}/OpenPLC_Editor/.venv/bin/python" -m pip install --upgrade pip
  "${srcdir}/OpenPLC_Editor/.venv/bin/python" -m pip install wheel jinja2 lxml==4.6.2 future matplotlib zeroconf pyserial pypubsub pyro5 attrdict3
  "${srcdir}/OpenPLC_Editor/.venv/bin/python" -m pip install wxPython==4.2.0

  echo -e "[Desktop Entry]\n\
Name=OpenPLC Editor\n\
Categories=Development;\n\
Exec=\"/opt/OpenPLC_Editor/openplc_editor.sh\"\n\
Icon=/opt/OpenPLC_Editor/editor/images/brz.png\n\
Type=Application\n\
Terminal=false" > OpenPLC_Editor.desktop

  cd "${srcdir}/OpenPLC_Editor"
  echo -e "#!/bin/bash\n\
cd \"/opt/OpenPLC_Editor\"\n\
./.venv/bin/python3 ./editor/Beremiz.py" > openplc_editor.sh
  chmod +x openplc_editor.sh
}

package() {
  install -dm755 "$pkgdir/opt"
  cp -r "${srcdir}/OpenPLC_Editor" "$pkgdir/opt/OpenPLC_Editor"
  install -Dm644 "OpenPLC_Editor.desktop" "${pkgdir}/usr/share/applications/OpenPLC_Editor.desktop"
}