Skip to content

Instantly share code, notes, and snippets.

@kinsamanka
Last active April 1, 2026 02:56
Show Gist options
  • Select an option

  • Save kinsamanka/23a58f89c69cd0b8b7b2cc8ba2432f41 to your computer and use it in GitHub Desktop.

Select an option

Save kinsamanka/23a58f89c69cd0b8b7b2cc8ba2432f41 to your computer and use it in GitHub Desktop.
flatpak for OpenPLC Editor
app-id: org.flatpak.openplc_editor
runtime: org.freedesktop.Platform
runtime-version: '21.08'
sdk: org.freedesktop.Sdk
command: openplc_editor.sh
finish-args:
- --share=network
- --filesystem=home
- --device=all
modules:
- name: python-2.7
sources:
- type: archive
url: https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
sha256: b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef43
config-opts:
- --enable-shared
- --with-ensurepip=yes
- --with-system-expat
- --with-system-ffi
- --enable-loadable-sqlite-extensions
- --with-dbmliborder=gdbm
- --enable-unicode=ucs4
post-install:
- chmod 644 $FLATPAK_DEST/lib/libpython2.7.so.1.0
cleanup:
- /bin/2to3*
- /bin/easy_install*
- /bin/idle*
- /bin/pydoc*
- /bin/python*-config
- /bin/pyvenv*
- /include
- /lib/pkgconfig
- /lib/python*/config
- /share
- /lib/python*/test
- /lib/python*/*/test
- /lib/python*/*/tests
- /lib/python*/lib-tk/test
- /lib/python*/lib-dynload/_*_test.*.so
- /lib/python*/lib-dynload/_test*.*.so
- /lib/python*/idlelib
- /lib/python*/tkinter*
- /lib/python*/turtle*
- /lib/python*/lib2to3*
- /lib/python2.7/config/libpython2.7.a
- name: glu
config-opts:
- --disable-static
sources:
- type: archive
url: https://mesa.freedesktop.org/archive/glu/glu-9.0.2.tar.xz
sha256: 6e7280ff585c6a1d9dfcdf2fca489251634b3377bfc33c29e4002466a38d02d4
cleanup:
- /include
- /lib/*.a
- /lib/*.la
- /lib/pkgconfig
- name: wxpython
buildsystem: simple
build-commands:
- ./autogen.sh
- ./configure --prefix=${FLATPAK_DEST} --with-gtk=3 --with-opengl
- make -j${FLATPAK_BUILDER_N_JOBS} install
- cd ${PWD}/wxPython &&
sed -i "s/WXPORT = 'gtk2'/WXPORT = 'gtk3'/g" config.py &&
CPPFLAGS="-I${FLATPAK_DEST}/include/wx-3.0 -I${FLATPAK_DEST}/lib/wx/include/gtk3-unicode-3.0"
python2 setup.py install --prefix=${FLATPAK_DEST}
sources:
- type: archive
url: https://downloads.sourceforge.net/project/wxpython/wxPython/3.0.2.0/wxPython-src-3.0.2.0.tar.bz2
sha256: d54129e5fbea4fb8091c87b2980760b72c22a386cb3b9dd2eebc928ef5e8df61
cleanup:
- /include
- /lib/*.a
- /lib/*.la
- /lib/pkgconfig
- /lib/wx
- /bin/wx-config
- /share
- name: pip-install
buildsystem: simple
build-options:
build-args:
- --share=network
build-commands:
- pip2 install --exists-action=i --no-build-isolation
future==0.18.2
zeroconf==0.19.1
numpy==1.16.5
matplotlib==2.0.2
lxml==4.6.2
pyro==3.16
sslpsk==1.0.0
pyserial==3.5
cleanup:
- /sslpsk
- name: openplc_editor
buildsystem: simple
build-commands:
- cp -a ${PWD}/. ${FLATPAK_DEST}/openplc_editor
- cd matiec &&
autoreconf -i &&
./configure &&
make -s &&
cp iec2c ${FLATPAK_DEST}/bin
- echo "#!/usr/bin/sh" > openplc_editor.sh
- echo "python2 /app/openplc_editor/editor/Beremiz.py" >> openplc_editor.sh
- install -D openplc_editor.sh ${FLATPAK_DEST}/bin/openplc_editor.sh
# patch for musl gcc
- sed -i 's/sigval_t/union sigval/g' ${FLATPAK_DEST}/openplc_editor/editor/targets/Linux/plc_Linux_main.c
- sed -i 's/O2/O2 -I\/app\/include/' ${FLATPAK_DEST}/openplc_editor/editor/targets/toolchain_gcc.py
sources:
- type: git
url: https://github.com/thiagoralves/OpenPLC_Editor
branch: master
cleanup:
- /openplc_editor/*sh
- /openplc_editor/*cmd
- /openplc_editor/wxpython
- name: static-musl-gcc
buildsystem: simple
build-commands:
- cp libexec/gcc/x86_64-linux-musl/11.2.1/cc1 ${FLATPAK_DEST}/bin
- cp bin/{gcc,as,ld} ${FLATPAK_DEST}/bin
- cp include -a ${FLATPAK_DEST}
- cp -P
lib/{crt?.o,libgcc_s.so*,librt.a,libc.a}
lib/gcc/*/*/{crtbeginS.o,crtendS.o,libgcc.a}
${FLATPAK_DEST}/lib
- sed -i '/__STDC_UTF_/d' ${FLATPAK_DEST}/include/stdc-predef.h
sources:
- type: archive
url: https://musl.cc/x86_64-linux-musl-native.tgz
sha256: eb1db6f0f3c2bdbdbfb993d7ef7e2eeef82ac1259f6a6e1757c33a97dbcef3ad
@kinsamanka

kinsamanka commented Aug 20, 2022

Copy link
Copy Markdown
Author

To build and install:

flatpak-builder --user --install --force-clean build-dir org.flatpak.openplc_editor.yml

To run:

flatpak run org.flatpak.openplc_editor

Update:

  • added musl gcc compiler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment