Add Snap Package.
For now :
- using makefile :
$ cd ~/build; make -f ~/src/beremiz_public_dist/Makefile DIST=snap
- build and run of python exemple was tested
- no fieldbus support yet.
--- a/Makefile Thu Jul 28 17:47:10 2022 +0200
+++ b/Makefile Sun Jul 31 16:43:25 2022 +0200
@@ -6,7 +6,7 @@
# build_in_docker.sh : use case example
# provision_bionic64.sh : prerequisites
-all: Beremiz-installer
+all: main_target
DIST ?= win32
@@ -17,8 +17,6 @@
CPUS := `cat /proc/cpuinfo | grep -e 'processor\W*:\W*[[:digit:]]*' | nl -n ln | tail -n1 | cut -f1`
BLKDEV=/dev/null
-XVFBRUN ?= xvfb-run
-
distfiles = $(src)/distfiles
sfmirror = downloads
tmp := $(shell rm -rf $${TMPDIR:-/tmp}/beremiz_dist_build_tmp.* ; mktemp -d -t beremiz_dist_build_tmp.XXXXXXXXXX)
@@ -49,8 +47,6 @@
get_src_sf=$(call get_src_http,https://$(sfmirror).sourceforge.net/project/$(1),$(2))
-include $(src)/windows_installer.mk
-
ifneq ("$(DIST)","")
include $(src)/$(DIST).mk
endif
@@ -96,7 +92,7 @@
echo "\n******* PACKAGE REVISIONS ********\n" > revisions.txt
(echo -n "beremiz_dist revision is: "; hg -R $(src) id;) >> revisions.txt
($(foreach project,$(OWN_PROJECTS),$(call show_revision_details,$(project)))) >> revisions.txt
- bash -c 'hg -R $(src) st | ( if read ; then echo -e "\n******* MODIFIED LPCDISTRO ********\n" ; hg -R $(src) st ; fi ) >> revisions.txt'
+ bash -c 'hg -R $(src) st | ( if read ; then echo -e "\n******* beremiz_public_dist IS MODIFIED ********\n" ; hg -R $(src) st ; fi ) >> revisions.txt'
--- a/revisions.txt Thu Jul 28 17:47:10 2022 +0200
+++ b/revisions.txt Sun Jul 31 16:43:25 2022 +0200
@@ -1,4 +1,4 @@
beremiz tip
-CanFestival-3 tip
+canfestival tip
Modbus tip
matiec tip
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/snap.mk Sun Jul 31 16:43:25 2022 +0200
@@ -0,0 +1,14 @@
+# Snap distribution
+
+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
+ 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/snapcraft.yaml Sun Jul 31 16:43:25 2022 +0200
@@ -0,0 +1,114 @@
+name: beremiz
+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.
+
+grade: devel
+confinement: devmode
+base: core20
+
+parts:
+
+ python-deps:
+ # 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:
+ - libssl-dev
+ - libgtk-3-dev
+ - libgl1-mesa-dev
+ - libglu1-mesa-dev
+ - python2-dev
+
+ 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.
+ 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 \
+ wxPython==4.1.1
+
+ beremiz:
+ # Beremiz python source + GCC toolchain
+ # source tree is expected to be just aside snap directory
+ plugin: nil
+ source: beremiz
+ source-type: local
+ stage-packages:
+ - gcc
+ - libc6
+ - libc6-dev
+ - linux-libc-dev
+ - libgcc-9-dev
+ - libgcc-s1
+
+ override-build: |
+ cp -a $SNAPCRAFT_PART_SRC $SNAPCRAFT_PART_INSTALL/beremiz
+
+ matiec:
+ # Matiec ST, SFC and IL compiler.
+ # source tree is expected to be just aside snap directory
+ plugin: nil
+ source: matiec
+ source-type: local
+ build-packages:
+ - build-essential
+ - automake
+ - flex
+ - bison
+ override-build: |
+ autoreconf -i && ./configure && make
+ cp -a $SNAPCRAFT_PART_BUILD $SNAPCRAFT_PART_INSTALL/matiec
+
+ revisiontxt:
+ # Makefile generated "revisions.txt"
+ plugin: nil
+ source: .
+ source-type: local
+ override-build: |
+ cp $SNAPCRAFT_PART_SRC/revisions.txt $SNAPCRAFT_PART_INSTALL
+
+apps:
+ ide:
+ environment:
+ SYSROOT: $SNAP
+ command: usr/bin/python2 $SNAP/beremiz/Beremiz.py
+ extensions: [gnome-3-38]
+
+ beremiz:
+ environment:
+ SYSROOT: $SNAP
+ command: usr/bin/python2 $SNAP/beremiz/Beremiz_cli.py
+
--- a/win32.mk Thu Jul 28 17:47:10 2022 +0200
+++ b/win32.mk Sun Jul 31 16:43:25 2022 +0200
@@ -1,5 +1,9 @@
# Win32 only distribution
+main_target: Beremiz-installer
+
+include $(src)/windows_installer.mk
+
OWN_PROJECTS_EX=canfestival
ide_targets_from_dist: canfestival
--- a/windows_installer.mk Thu Jul 28 17:47:10 2022 +0200
+++ b/windows_installer.mk Sun Jul 31 16:43:25 2022 +0200
@@ -14,6 +14,8 @@
msysdir=msys32
MSYS_ROOT=$(CURDIR)/$(msysdir)
+XVFBRUN ?= xvfb-run
+
mingw32dir=$(msysdir)/mingw32
mingw32finaldir=installer/mingw32