snap/snapcraft.yaml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sat, 07 Oct 2023 17:37:00 +0200
changeset 123 032aaa29f498
parent 106 cf158979ecae
child 124 9304b56075c2
permissions -rw-r--r--
Add Python3 in Snap build + doc fixes
name: beremiz
adopt-info: beremiz
title: Beremiz
summary: Beremiz Open Source PLC.
description: |
  Beremiz is a framework for machine automation. It is meant to add PLC-like programing to embedded systems.

  Beremiz is [Free Software](https://en.wikipedia.org/wiki/Free_software), and conforms to
  [IEC_61131](https://en.wikipedia.org/wiki/IEC_61131-3) and [PLCopen](https://plcopen.org/technical-activities/xml-exchange) among other standards.

  Beremiz supports all languages described in IEC_61131:
  * Structured Text (ST)
  * Instruction List (IL)
  * Function Block Diagram (FBD)
  * Sequencial Function Chart (SFC)
  * Ladder Diagram (LD)

  IDE also includes tools to create Human-Machine Interfaces (HMI), and to connect your PLC programs to existing supervisions, databases, or fieldbuses:
  * Modbus
  * OPC-UA
  * CANopen
  * SVG HMI
  * Wx HMI
  * Python
  * ...

  Runtime can be programmed remotely and allows variables tracing and forcing.

icon: snap/gui/beremiz.png
contact: 
  - https://beremiz.org
  - snap@beremiz.fr


grade: devel
confinement: strict
base: core22
architectures: [amd64, arm64]

parts:

  beremiz:
    # Beremiz python source and dependencies, inc. native GCC
    # source tree is expected to be just aside snap directory
    plugin: python
    source: beremiz
    source-type: local
    python-requirements:
      - requirements.txt
    # native GCC toolchain
    # note: GCC toolchain cannot be move to separate part
    # otherwise there is a file conflict about lib64 in prime step
    # caused apparently by libc6 (needed to have consistent sysroot)
    stage-packages:
      - gcc
      - libc6
      - libc6-dev
      - linux-libc-dev
      - libgcc-9-dev
      - libgcc-s1
    override-pull: |
      snapcraftctl pull
      snapcraftctl set-version `python3 $SNAPCRAFT_PART_SRC/version.py`
    override-build: |
      snapcraftctl 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

  modbus:
    plugin: nil
    source: Modbus
    source-type: local
    build-packages:
      - build-essential
      - automake
    override-build: |
      make
      cp -a $SNAPCRAFT_PART_BUILD $SNAPCRAFT_PART_INSTALL/Modbus

  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
    source: .
    source-type: local
    override-build: |
      cp $SNAPCRAFT_PART_SRC/revisions.txt $SNAPCRAFT_PART_INSTALL

apps:
  ide:
    # Launcher for the IDE
    environment:
      SYSROOT: $SNAP
    command: bin/python3 $SNAP/beremiz/Beremiz.py
    extensions: [gnome]
    plugs:
      - network
      - network-bind

  beremiz:
    # Beremiz Command Line interface
    environment:
      SYSROOT: $SNAP
    command: bin/python3 $SNAP/beremiz/Beremiz_cli.py
    plugs:
      - network
      - network-bind
 
  runtime:
    # Standalone runtime
    environment:
      SYSROOT: $SNAP
    command: bin/python3 $SNAP/beremiz/Beremiz_service.py
    plugs:
      - network
      - network-bind