SNAP: add SVGHMI and OPC-UA dependencies
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sat, 06 Aug 2022 16:39:37 +0200
changeset 81 a95b2fa896e9
parent 80 1088ce57d3c9
child 82 90da520cbaa5
SNAP: add SVGHMI and OPC-UA dependencies
Makefile
snap.mk
snap/gui/beremiz.desktop
snap/gui/beremiz.png
snap/snapcraft.yaml
win32.mk
--- a/Makefile	Sun Jul 31 17:54:19 2022 +0200
+++ b/Makefile	Sat Aug 06 16:39:37 2022 +0200
@@ -51,7 +51,7 @@
 include $(src)/$(DIST).mk
 endif
 
-OWN_PROJECTS=beremiz matiec $(OWN_PROJECTS_EX)
+OWN_PROJECTS=beremiz matiec canfestival
 
 define get_revision
 $(1)_revision?=$(lastword $(shell grep $(1) $(src)/revisions.txt))
@@ -83,6 +83,16 @@
 own_sources: $(foreach project,$(OWN_PROJECTS), sources/$(project)_src)
 	touch $@
 
+all_sources: own_sources sources/open62541_src
+	touch $@
+
+sources/open62541_src:
+	rm -rf sources/open62541
+	$(call get_src_http,https://github.com/open62541/open62541/archive/refs/tags,v1.3.2.tar.gz)\
+	tar -xzf $$dld
+	mv open62541-1.3.2 sources/open62541
+	
+
 define show_revision_details
 echo -n $(1) "revision is: "; hg -R $(HGROOT)/$(1) id -r $($(1)_revisionid);
 endef
--- a/snap.mk	Sun Jul 31 17:54:19 2022 +0200
+++ b/snap.mk	Sat Aug 06 16:39:37 2022 +0200
@@ -2,13 +2,10 @@
 
 main_target: Snap
 
-OWN_PROJECTS_EX=canfestival
-
 tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp
 
 Snap: snap_built
-snap_built: own_sources revisions.txt
-	#cp -a $(src)/snap $(src)/revisions.txt sources
+snap_built: all_sources revisions.txt
 	tar -C $(src) $(tar_opts) -c snap revisions.txt | tar -C sources -x
 	cd sources;  snapcraft --debug 
 	touch $@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/snap/gui/beremiz.desktop	Sat Aug 06 16:39:37 2022 +0200
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Application
+Name=Beremiz IDE
+Comment=IEC-61131 Open Source PLC programming
+Exec=beremiz.ide %f
+Icon=${SNAP}/meta/gui/beremiz.png
Binary file snap/gui/beremiz.png has changed
--- a/snap/snapcraft.yaml	Sun Jul 31 17:54:19 2022 +0200
+++ b/snap/snapcraft.yaml	Sat Aug 06 16:39:37 2022 +0200
@@ -2,7 +2,9 @@
 version: '1.3-beta2'
 summary: Beremiz
 description: |
-  Beremiz is an integrated development environment for machine automation. It is Free Software, conforming to IEC-61131 among other standards.
+  Beremiz is Free and Open Source PLC. It brings Free Software IDE (GPL) and Runtime (LGPL) for machine automation, conforming to IEC-61131.
+# TODO icon
+
 
 grade: devel
 confinement: devmode
@@ -14,10 +16,11 @@
     # This part provides all python2 dependencies, including interpreter
     # More particularily, it builds latest PIP supporting python2 from git
     # and uses it to collect and buid other Beremiz dependencies.
-
+    #
     # rational:
     #  - python plugin doesn't support python2 anymore on core20+
     #  - attempts to get python2+pip+virtualenv in a core20 based snap failed
+
     plugin: nil
     source: https://github.com/pypa/pip/archive/refs/tags/20.3.4.tar.gz
     build-packages:
@@ -30,34 +33,35 @@
     stage-packages:
       - python2
       - python-setuptools
-      # libs reclaimed by snapcraft at the end of wxPython build
-      # TODO: test if still necessary since using "extensions: [gnome-3-38]"
-      - libgtk-3-0
-      - libegl1
-      - libgl1
-      - libsm6
-      - libxtst6
 
     override-build: |
       # For some reasons site-packages needs to be created and 
       # added to PYTHONPATH during PIP (own) build.
-      # Strangely, not anymore when snap is executed.
+      # Apparently not anymore when snap is executed.
       mkdir $SNAPCRAFT_PART_INSTALL/usr/lib/python2.7/site-packages
-      PYTHONPATH=$SNAPCRAFT_PART_INSTALL/usr/lib/python2.7/site-packages $SNAPCRAFT_PART_INSTALL/usr/bin/python2 $SNAPCRAFT_PART_SRC/setup.py install --prefix $SNAPCRAFT_PART_INSTALL/usr
-      PYTHONPATH=$SNAPCRAFT_PART_INSTALL/usr/lib/python2.7/site-packages $SNAPCRAFT_PART_INSTALL/usr/bin/pip install \
-          lxml \
-          future \
-          matplotlib \
-          zeroconf2 \
-          enum34 \
-          pyro \
-          sslpsk \
-          posix_spawn \
-          twisted \
-          nevow \
-          autobahn \
-          click \
-          opcua \
+      PYTHONPATH=$SNAPCRAFT_PART_INSTALL/usr/lib/python2.7/site-packages \
+        $SNAPCRAFT_PART_INSTALL/usr/bin/python2 $SNAPCRAFT_PART_SRC/setup.py \
+            install --prefix $SNAPCRAFT_PART_INSTALL/usr
+      PYTHONPATH=$SNAPCRAFT_PART_INSTALL/usr/lib/python2.7/site-packages \
+        $SNAPCRAFT_PART_INSTALL/usr/bin/pip install \
+          lxml                \
+          future              \
+          matplotlib          \
+          msgpack_python      \
+          u-msgpack-python    \
+          zeroconf2           \
+          enum34              \
+          pyro                \
+          sslpsk              \
+          posix_spawn         \
+          twisted             \
+          nevow               \
+          autobahn            \
+          click               \
+          opcua               \
+          pycountry           \
+          fonttools           \
+          Brotli              \
           wxPython==4.1.1
 
   beremiz:
@@ -73,7 +77,6 @@
       - linux-libc-dev
       - libgcc-9-dev
       - libgcc-s1
-
     override-build: |
       cp -a $SNAPCRAFT_PART_SRC $SNAPCRAFT_PART_INSTALL/beremiz
 
@@ -91,7 +94,30 @@
     override-build: |
       autoreconf -i && ./configure && make
       cp -a $SNAPCRAFT_PART_BUILD $SNAPCRAFT_PART_INSTALL/matiec
+
+  open62541:
+    plugin: nil
+    source: open62541
+    source-type: local
+    build-packages:
+      - build-essential
+      - cmake
+    override-build: |
+      mkdir build && cd build && cmake .. && make
+      cp -a $SNAPCRAFT_PART_BUILD $SNAPCRAFT_PART_INSTALL/open62541
       
+  inkscape:
+    # CLI only, used in SVGHMI build
+    # GUI fails to launch couldn't find a way
+    plugin: nil
+    stage-packages:
+      - inkscape
+      - libgtk-3-0 
+      # libgtk3 needs to be explicitely given
+      # otherwise wxGtk doesn't start, with this error :
+      # libgtk-3.so.0: undefined symbol: pango_font_family_get_face
+      # ... why ?
+
   revisiontxt:
     # Makefile generated "revisions.txt"
     plugin: nil
@@ -102,13 +128,20 @@
 
 apps:
   ide:
+    # Launcher for the IDE
     environment:
       SYSROOT: $SNAP
     command: usr/bin/python2 $SNAP/beremiz/Beremiz.py
     extensions: [gnome-3-38]
 
   beremiz:
+    # Beremiz Command Line interface
     environment:
       SYSROOT: $SNAP
     command: usr/bin/python2 $SNAP/beremiz/Beremiz_cli.py
-
+ 
+  runtime:
+    # Standalone runtime
+    environment:
+      SYSROOT: $SNAP
+    command: usr/bin/python2 $SNAP/beremiz/Beremiz_service.py
--- a/win32.mk	Sun Jul 31 17:54:19 2022 +0200
+++ b/win32.mk	Sat Aug 06 16:39:37 2022 +0200
@@ -4,8 +4,6 @@
 
 include $(src)/windows_installer.mk
 
-OWN_PROJECTS_EX=canfestival
-
 ide_targets_from_dist: canfestival
 	touch $@