New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sat, 04 Sep 2021 01:35:11 +0200
changeset 37 fd09116d3537
parent 36 ad68e85dc416
child 38 3991f82369cb
New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
.dockerignore
.hgignore
Dockerfile
M2Crypto-mingw-cross-compile-fix.patch
Makefile
README.md
build_docker_image.sh
build_in_docker.sh
clean_docker_container.sh
clean_docker_image.sh
create_docker_container.sh
distfiles/python-2.7.13.msi.md5
enter_docker.sh
enter_docker_as_root.sh
install.nsi
pacman-6.0.0-nogpg-relative_conf.patch
provision_focal64.sh
provision_xenial64.sh
public.mk
rebuild_docker.sh
revisions.txt
win32.mk
windows_installer.mk
--- a/.dockerignore	Sun Dec 17 01:29:32 2017 +0100
+++ b/.dockerignore	Sat Sep 04 01:35:11 2021 +0200
@@ -1,4 +1,2 @@
-.?*
-Dockerfile
-Vagrantfile
-*.log
+*
+!provision_focal64.sh
--- a/.hgignore	Sun Dec 17 01:29:32 2017 +0100
+++ b/.hgignore	Sat Sep 04 01:35:11 2021 +0200
@@ -1,10 +1,4 @@
 .*~
 .*\.swp
 distfiles/.*[.](?!.*md5$).*$
-examples/.*
-build/.*
-beremiz
-canfestival
-matiec
-mingw
-python
+distfiles/http/.*
--- a/Dockerfile	Sun Dec 17 01:29:32 2017 +0100
+++ b/Dockerfile	Sat Sep 04 01:35:11 2021 +0200
@@ -1,29 +1,16 @@
-# Builds Beremiz windows installer
+# Dockerfile to setup beremiz_public_dist build container
 
-# initialize :
-#   docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t beremiz_builder .
-#
-# build installer in ~/build, fetch source from repo :
-#   docker run -v ~/build/:/home/devel/build beremiz_builder
-#
-# build installer in ~/build, taking source from ~/src :
-#   docker run -v ~/src:/home/devel/src -v ~/build/:/home/devel/build --rm beremiz_builder \
-#       xvfb-run make -C /home/devel/build -f /home/devel/src/LPC-2.MC9_distro/Makefile
-#
-# to use on code-build-test cycle :
-#   docker create --name current -v ~/src:/home/devel/src -v ~/build/:/home/devel/build -i -t beremiz_builder /bin/bash
-#   docker start -i current 
-#       # call build operations from here
-#   docker stop current
-#   docker rm current
-
-FROM ubuntu:xenial
+FROM ubuntu:focal
 
 ENV TERM xterm-256color
 
-COPY provision_xenial64.sh .
+COPY provision_focal64.sh .
 
-RUN ./provision_xenial64.sh
+RUN ./provision_focal64.sh
+
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
 
 ARG UNAME=devel
 ENV UNAME ${UNAME}
@@ -34,7 +21,8 @@
 USER $UNAME
 
 RUN mkdir /home/$UNAME/build /home/$UNAME/src
-COPY . /home/$UNAME/src/beremiz_public_dist/
 
-CMD xvfb-run make -C /home/$UNAME/build -f /home/$UNAME/src/beremiz_public_dist/Makefile
-
+# easy to remember 'build' alias to invoke main makefile
+ARG OWNDIRBASENAME=beremiz_public_dist
+ENV OWNDIRBASENAME ${OWNDIRBASENAME}
+RUN echo "alias build='make -C /home/"$UNAME"/build -f /home/devel/src/"$OWNDIRBASENAME"/Makefile'">/home/$UNAME/.bash_aliases
--- a/M2Crypto-mingw-cross-compile-fix.patch	Sun Dec 17 01:29:32 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-diff -pruN M2Crypto-0.22.6rc2.orig/setup.py M2Crypto-0.22.6rc2/setup.py
---- M2Crypto-0.22.6rc2.orig/setup.py	2015-10-19 14:34:45.000000000 +0200
-+++ M2Crypto-0.22.6rc2/setup.py	2015-10-20 18:48:14.231865096 +0200
-@@ -28,6 +28,23 @@ except ImportError:
- from distutils.core import Extension
- from distutils.file_util import copy_file
- 
-+# DISTUTILS HOT PATCH
-+from distutils.cygwinccompiler import Mingw32CCompiler
-+_old_mw32_init=Mingw32CCompiler.__init__
-+def Mingw32CCompInit(self, *args, **kwargs):
-+    _old_mw32_init(self, *args, **kwargs)
-+    for n in ["compiler", "compiler_so", "compiler_cxx", "linker_so"] :
-+        l = getattr(self,n)
-+        pfx = os.getenv("MINGCCPREFIX")
-+        l[0] = pfx+l[0]
-+    self.linker_so.insert(1, "-static-libgcc")
-+Mingw32CCompiler.__init__ = Mingw32CCompInit
-+
-+import distutils
-+distutils.sysconfig.get_python_inc = lambda *x,**y : os.getenv("PYTHONINC")
-+distutils.cygwinccompiler.get_msvcr = lambda *x,**y : []
-+distutils.util.get_platform = lambda *x,**y : "win32" 
-+distutils.sysconfig._init_nt()
- 
- class _M2CryptoBuildExt(build_ext.build_ext):
-     '''Specialization of build_ext to enable swig_opts to inherit any
-@@ -40,14 +57,9 @@ class _M2CryptoBuildExt(build_ext.build_
- 
-         build_ext.build_ext.initialize_options(self)
- 
--        # openssl is the attribute corresponding to openssl directory prefix
--        # command line option
--        if os.name == 'nt':
--            self.libraries = ['ssleay32', 'libeay32']
--            self.openssl = 'c:\\pkg'
--        else:
--            self.libraries = ['ssl', 'crypto']
--            self.openssl = '/usr'
-+        self.openssl = "mhooooo"
-+        self.libraries = ['ssleay32', 'libeay32']
-+        self.libraries += ['ws2_32', 'crypt32', 'gdi32', "python27", "winstrm"]
- 
-     def finalize_options(self):
-         '''Overloaded build_ext implementation to append custom openssl
-@@ -56,7 +68,8 @@ class _M2CryptoBuildExt(build_ext.build_
-         build_ext.build_ext.finalize_options(self)
- 
-         openssl_include_dir = os.path.join(self.openssl, 'include')
--        openssl_library_dir = os.path.join(self.openssl, 'lib')
-+        #openssl_library_dir = os.path.join(self.openssl, 'lib')
-+        openssl_library_dir = self.openssl
- 
-         self.swig_opts = ['-I%s' % i for i in self.include_dirs +
-                           [openssl_include_dir]]
-@@ -90,7 +103,7 @@ class _M2CryptoBuildExt(build_ext.build_
-             # Someday distutils will be fixed and this won't be needed.
-             self.library_dirs += [os.path.join(self.openssl, 'bin')]
- 
--        self.library_dirs += [os.path.join(self.openssl, openssl_library_dir)]
-+        self.library_dirs += [os.getenv("PYTHONLIB"), os.path.join(self.openssl, openssl_library_dir)]
- 
-     def run(self):
-         '''Overloaded build_ext implementation to allow inplace=1 to work,
-diff -pruN M2Crypto-0.22.6rc2.orig/SWIG/_ssl.i M2Crypto-0.22.6rc2/SWIG/_ssl.i
---- M2Crypto-0.22.6rc2.orig/SWIG/_ssl.i	2015-10-17 21:06:56.000000000 +0200
-+++ M2Crypto-0.22.6rc2/SWIG/_ssl.i	2015-10-20 18:48:24.835905739 +0200
-@@ -10,6 +10,9 @@
- /* $Id$ */
- 
- %{
-+#define _WIN32_WINNT 0x0600
-+#include <winsock2.h>
-+#undef _WIN32_WINNT
- #include <pythread.h>
- #include <limits.h>
- #include <openssl/bio.h>
-@@ -17,7 +19,6 @@
- #include <openssl/ssl.h>
- #include <openssl/tls1.h>
- #include <openssl/x509.h>
--#include <poll.h>
- #include <sys/time.h>
- %}
- 
-@@ -514,7 +515,7 @@ static int ssl_sleep_with_timeout(SSL *s
-         return -1;
-     }
-     Py_BEGIN_ALLOW_THREADS
--    tmp = poll(&fd, 1, ms);
-+    tmp = WSAPoll(&fd, 1, ms);
-     Py_END_ALLOW_THREADS
-     switch (tmp) {
-     	case 1:
--- a/Makefile	Sun Dec 17 01:29:32 2017 +0100
+++ b/Makefile	Sat Sep 04 01:35:11 2021 +0200
@@ -1,394 +1,98 @@
 #! gmake
 
-# This is Makefile for Beremiz installer
-#
-# Invoke with "make -f path/to/Makefile" on a linux box
-# in directory where build should happen.
-#
-# All those dependencies have to be installed :
-#
-#  Windows installer :
-#  - wine (tested with 1.2 and 1.6. Fail with 1.4)
-#  - mingw32
-#  - flex
-#  - bison
-#  - tar
-#  - unrar
-#  - wget
-#  - nsis
-#  - libtool
-#  - xmlstarlet
-#  - xsltproc
-#  - python-lxml
-#
-# WARNING : DISPLAY variable have to be defined to a valid X server
-#           in case it would be a problem, run :
-#           xvfb-run make -f /path/to/this/Makefile
+# This is top level Makefile for beremiz_public_dist
 
-version = 1.2-rc1
+# see also: 
+#   build_in_docker.sh : use case example
+#   provision_bionic64.sh : prerequisites
+
+all: Beremiz-installer
+
+DIST ?= win32
 
 src := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
-HGREMOTE ?= https://hg.beremiz.org/
+HGREMOTE ?= REMOTE_HG_DISABLED
 HGROOT ?= $(abspath $(src)/..)
 GITROOT := $(HGROOT)
-DIST =
 CPUS := `cat /proc/cpuinfo | grep -e 'processor\W*:\W*[[:digit:]]*' | nl -n ln | tail -n1 | cut -f1`
 BLKDEV=/dev/null
 
-
-CROSS_COMPILE=i686-w64-mingw32
-CROSS_COMPILE_LIBS_DIR=$(shell dirname $(shell $(CROSS_COMPILE)-gcc -print-libgcc-file-name))
-CC=$(CROSS_COMPILE)-gcc
-CXX=$(CROSS_COMPILE)-g++
-
-define get_runtime_libs
-	cp $(CROSS_COMPILE_LIBS_DIR)/libgcc_s_sjlj-1.dll $(1)
-	cp $(CROSS_COMPILE_LIBS_DIR)/libstdc++-6.dll $(1)
-endef
+XVFBRUN ?= xvfb-run
 
 distfiles = $(src)/distfiles
 sfmirror = downloads
-tmp := $(shell mktemp -d)
+tmp := $(shell rm -rf $${TMPDIR:-/tmp}/beremiz_dist_build_tmp.* ; mktemp -d -t beremiz_dist_build_tmp.XXXXXXXXXX)
 
 define hg_get_archive
-test -d $(HGROOT)/`basename $(1)` || hg --cwd $(HGROOT) clone $(HGREMOTE)`basename $(1)`
-hg -R $(HGROOT)/`basename $(1)` archive $(2) $(1)
-hg -R $(HGROOT)/`basename $(1)` id -i | sed 's/\+//' > $(1)/revision
+	test -d $(HGROOT)/`basename $(1)` || hg --cwd $(HGROOT) clone $(HGREMOTE)`basename $(1)`;\
+	hg -R $(HGROOT)/`basename $(1)` archive $(2) $(1);\
+	hg -R $(HGROOT)/`basename $(1)` id -i | sed 's/\+//' > $(1)/revision;
 endef
 
 define get_src_hg
-rm -rf $(1)
-$(call hg_get_archive, $(1), $(2))
+	rm -rf $(1);\
+	$(call hg_get_archive, $(1), $(2))
 endef
 
 define get_src_git
-rm -rf $(1)
-mkdir $(1)
-(cd $(GITROOT)/`basename $(1)`; git archive --format=tar $(2)) | tar -C $(1) -x
+	rm -rf $(1)
+	test -d $(GITROOT)/`basename $(1)` || git clone $(3) $(GITROOT)/`basename $(1)`
+	mkdir $(1)
+	(cd $(GITROOT)/`basename $(1)`; git archive --format=tar $(2)) | tar -C $(1) -x
 endef
 
 define get_src_http
-dld=$(distfiles)/`echo $(2) | tr ' ()' '___'`;( ( [ -f $$dld ] || wget $(1)/$(2) -O $$dld ) && ( [ ! -f $$dld.md5 ] && (cd $(distfiles);md5sum `basename $$dld`) > $$dld.md5 || (cd $(distfiles);md5sum -c `basename $$dld.md5`) ) ) &&
+	dld=$(distfiles)/`echo $(2) | tr ' ()' '___'`;( ( [ -f $$dld ] || wget $(1)/$(2) -O $$dld ) && ( [ ! -f $$dld.md5 ] && (cd $(distfiles);md5sum `basename $$dld`) > $$dld.md5 || (cd $(distfiles);md5sum -c `basename $$dld.md5`) ) ) &&
 endef
 
-define get_src_pypi
-$(call get_src_http,https://pypi.python.org/packages/$(1),$(2))
-endef
+get_src_pypi=$(call get_src_http,https://pypi.python.org/packages/$(1),$(2))
 
-define get_src_sf
-$(call get_src_http,https://$(sfmirror).sourceforge.net/project/$(1),$(2))
-endef
+get_src_sf=$(call get_src_http,https://$(sfmirror).sourceforge.net/project/$(1),$(2))
 
-all: Beremiz-$(version).exe $(targets_add)
-
+include $(src)/windows_installer.mk
 
 ifneq ("$(DIST)","")
 include $(src)/$(DIST).mk
 endif
 
-build:
-	rm -rf build
-	mkdir -p build
+OWN_PROJECTS=beremiz matiec $(OWN_PROJECTS_EX)
 
-# native toolchain, pre-built
-mingwdir=build/mingw
+define get_revision
+$(1)_revision?=$(lastword $(shell grep $(1) $(src)/revisions.txt))
+endef
+$(foreach project,$(OWN_PROJECTS),$(eval $(call get_revision,$(project))))
 
-define get_mingw
-$(call get_src_sf,mingw/MinGW/Base/$(1),$(2)) tar -C $(mingwdir) -xf $$dld
+define get_revisionid
+$(1)_revisionid=$(shell hg -R $(HGROOT)/$(1) id -i -r $($(1)_revision))
 endef
-define get_msys
-$(call get_src_sf,mingw/MSYS/Base/$(1),$(2)) tar -C $(mingwdir) -xf $$dld
+$(foreach project,$(OWN_PROJECTS),$(eval $(call get_revisionid,$(project))))
+
+sources:
+	mkdir -p sources
+
+define make_src_rule
+sources/$(1)_src: sources/$(1)_$($(1)_revisionid)
+	touch $$@
+
+sources/$(1)_$($(1)_revisionid): | sources
+	rm -rf sources/$(1)*
+	$(call get_src_hg,sources/$(1),-r $($(1)_revisionid))
+	touch $$@
 endef
-mingw: |build
-	rm -rf $(mingwdir)
-	mkdir -p $(mingwdir)
-	# windows.h
-	$(call get_mingw,w32api/w32api-5.0.1,w32api-5.0.1-mingw32-dev.tar.xz)
-	# mingw runtime
-	$(call get_mingw,mingwrt/mingwrt-5.0.1,mingwrt-5.0.1-mingw32-dll.tar.xz)
-	$(call get_mingw,mingwrt/mingwrt-5.0.1,libmingwex-5.0.1-mingw32-dll-0.tar.xz)
-	$(call get_mingw,isl/isl-0.18,libisl-0.18-1-mingw32-dll-15.tar.xz)
-	# mingw headers and lib
-	$(call get_mingw,mingwrt/mingwrt-5.0.1,mingwrt-5.0.1-mingw32-dev.tar.xz)
-	# binutils
-	$(call get_mingw,binutils/binutils-2.28,binutils-2.28-1-mingw32-bin.tar.xz)
-	# C compiler
-	$(call get_mingw,gcc/Version6/gcc-6.3.0,gcc-core-6.3.0-1-mingw32-bin.tar.xz)
-	$(call get_mingw,gcc/Version6/gcc-6.3.0,libgcc-6.3.0-1-mingw32-dll-1.tar.xz)
-	# dependencies
-	$(call get_mingw,gmp/gmp-6.1.2,libgmp-6.1.2-2-mingw32-dll-10.tar.xz)
-	$(call get_mingw,mpc/mpc-1.0.3,libmpc-1.0.3-1-mingw32-dll-3.tar.xz)
-	$(call get_mingw,mpfr/mpfr-3.1.5,libmpfr-3.1.5-1-mingw32-dll-4.tar.xz)
-	$(call get_mingw,gettext/gettext-0.18.3.2-2,libintl-0.18.3.2-2-mingw32-dll-8.tar.xz)
-	$(call get_mingw,gettext/gettext-0.18.3.2-2,libgettextpo-0.18.3.2-2-mingw32-dll-0.tar.xz)
-	$(call get_mingw,libiconv/libiconv-1.14-3,libiconv-1.14-3-mingw32-dll.tar.lzma)
+$(foreach project,$(OWN_PROJECTS),$(eval $(call make_src_rule,$(project))))
 
-	# make, bash, and dependencies
-	$(call get_msys,bash/bash-3.1.23-1,bash-3.1.23-1-msys-1.0.18-bin.tar.xz)
-	$(call get_msys,coreutils/coreutils-5.97-3,coreutils-5.97-3-msys-1.0.13-bin.tar.lzma)
-	$(call get_msys,libiconv/libiconv-1.14-1,libiconv-1.14-1-msys-1.0.17-bin.tar.lzma)
-	$(call get_msys,libiconv/libiconv-1.14-1,libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma)
-	$(call get_msys,gettext/gettext-0.18.1.1-1,libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma)
-	$(call get_msys,regex/regex-1.20090805-2,libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma)
-	$(call get_msys,termcap/termcap-0.20050421_1-2,libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma)
-	$(call get_msys,make/make-3.81-3,make-3.81-3-msys-1.0.13-bin.tar.lzma) 
-	$(call get_msys,msys-core/msys-1.0.19-1,msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz)
-	$(call get_msys,termcap/termcap-0.20050421_1-2,libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma)
+own_sources: $(foreach project,$(OWN_PROJECTS), sources/$(project)_src)
 	touch $@
 
-msiexec = WINEPREFIX=$(tmp) msiexec
-wine = WINEPREFIX=$(tmp) wine
-pydir = build/python
-pysite = $(pydir)/Lib/site-packages
+define show_revision_details
+echo -n $(1) "revision is: "; hg -R $(HGROOT)/$(1) id -r $($(1)_revisionid);
+endef
 
-python: |build
-	rm -rf $(pydir)
-	mkdir -p $(pydir)
-	
-	# Python
-	$(call get_src_http,http://www.python.org/ftp/python/2.7.3,python-2.7.3.msi)\
-	$(msiexec) /qn /a $$dld TARGETDIR=.\\$(pydir)
-	
-	# WxPython 2.8 (needs running inno unpacker in wine)
-	$(call get_src_sf,innounp/innounp/innounp%200.36,innounp036.rar)\
-	unrar e $$dld innounp.exe $(tmp)
-	$(call get_src_sf,wxpython/wxPython/2.8.12.1,wxPython2.8-win32-unicode-2.8.12.1-py27.exe)\
-	$(wine) $(tmp)/innounp.exe -d$(tmp)/wx28 -x $$dld
-	cp -R $(tmp)/wx28/\{code_GetPythonDir\}/* $(pydir)
-	cp -R $(tmp)/wx28/\{app\}/* $(pysite)
-	
-	# WxPython 3.0 (needs running inno unpacker in wine)
-	$(call get_src_sf,wxpython/wxPython/3.0.2.0,wxPython3.0-win32-3.0.2.0-py27.exe)\
-	$(wine) $(tmp)/innounp.exe -d$(tmp)/wx30 -x $$dld
-	cp -R $(tmp)/wx30/\{code_GetPythonDir\}/* $(pydir)
-	cp -R $(tmp)/wx30/\{app\}/* $(pysite)
-	
-	# wxPython fails if VC9.0 bullshit is not fully here.
-	$(call get_src_http,http://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140,vcredist_x86.exe)\
-	cp $$dld $(tmp)
-	$(wine) $(tmp)/vcredist_x86.exe /qn /a
-	cp $(tmp)/drive_c/windows/winsxs/x86_Microsoft.VC90.CRT*/* $(pydir)
-	
-	# MathPlotLib
-	$(call get_src_http,https://github.com/downloads/matplotlib/matplotlib,matplotlib-1.2.0.win32-py2.7.exe)\
-	unzip -d $(tmp)/mathplotlib $$dld ; [ $$? -eq 1 ] #silence error unziping .exe
-	cp -R $(tmp)/mathplotlib/PLATLIB/* $(pysite)
-	
-	# pywin32
-	$(call get_src_sf,pywin32/pywin32/Build216,pywin32-216.win32-py2.7.exe)\
-	unzip -d $(tmp)/pw32 $$dld ; [ $$? -eq 1 ] #silence error unziping .exe
-	cp -R $(tmp)/pw32/PLATLIB/* $(pysite)
-	
-	# zope.interface (twisted prereq)
-	$(call get_src_pypi,9d/2d/beb32519c0bd19bda4ac38c34db417d563ee698518e582f951d0b9e5898b,zope.interface-4.3.2-py2.7-win32.egg)\
-	unzip -d $(tmp) $$dld
-	cp -R $(tmp)/zope $(pysite)
-	
-	# six (pyopenssl prereq)
-	$(call get_src_pypi,67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a,six-1.11.0-py2.py3-none-any.whl)\
-	unzip -d $(tmp) $$dld 
-	cp -R $(tmp)/six.py $(pysite)
-	
-	# enum34 (cryptography prereq)
-	$(call get_src_pypi,bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876,enum34-1.1.6.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/enum34-1.1.6/enum $(pysite)
-	
-	# cryptography (pyopenssl prereq)
-	$(call get_src_pypi,17/08/04dc376411968ac21f2e11a8d7d70e936a654172567672fa79710a137bd9,cryptography-2.1.4-cp27-cp27m-win32.whl)\
-	unzip -d $(tmp) $$dld 
-	cp -R $(tmp)/cryptography $(pysite)
-	
-	# pyopenssl (twisted/ssl prereq)
-	$(call get_src_pypi,79/db/7c0cfe4aa8341a5fab4638952520d8db6ab85ff84505e12c00ea311c3516,pyOpenSSL-17.5.0-py2.py3-none-any.whl)\
-	unzip -d $(tmp) $$dld 
-	cp -R $(tmp)/OpenSSL $(pysite)
-	
-	# pyasn1 (service identity prereq)
-	$(call get_src_pypi,eb/3d/b7d0fdf4a882e26674c68c20f40682491377c4db1439870f5b6f862f76ed,pyasn1-0.4.2.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/pyasn1-0.4.2/pyasn1 $(pysite)
-	
-	# pyasn1-modules (service identity prereq)
-	$(call get_src_pypi,ab/76/36ab0e099e6bd27ed95b70c2c86c326d3affa59b9b535c63a2f892ac9f45,pyasn1-modules-0.2.1.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/pyasn1-modules-0.2.1/pyasn1_modules $(pysite)
-	
-	# characteristic (service identity prereq)
-	$(call get_src_pypi,dc/66/54b7a4758ea44fbc93895c7745060005272560fb2c356f2a6f7448ef9a80,characteristic-14.3.0.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/characteristic-14.3.0/characteristic.py $(pysite)
-	
-	# service identity (twisted prereq)
-	$(call get_src_pypi,de/2a/cab6e30be82c8fcd2339ef618036720eda954cf05daef514e386661c9221,service_identity-17.0.0.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/service_identity-17.0.0/src/service_identity $(pysite)
-	
-	# txaio (autobahn prereq)
-	$(call get_src_pypi,d6/95/d0c67304515f352342bc8fd14e5a3e7ca924134608acb730916073b18464,txaio-2.8.2.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/txaio-2.8.2/txaio $(pysite)
-	
-	# python-msgpack (autobahn prereq)
-	$(call get_src_pypi,59/ca/b8048e184a2edb5b3cd46f38be130e87cbce77f4168ed62344bc33df3e1b,msgpack_python-0.4.8-cp27-cp27m-win32.whl)\
-	unzip -d $(tmp) $$dld 
-	cp -R $(tmp)/msgpack $(pysite)
-	
-	# u-msgpack-python (autobahn prereq)
-	$(call get_src_pypi,b8/ff/5730f61767d5acecac103343d66ebf631ebd672fa14e50472f05545749c2,u-msgpack-python-2.4.1.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/u-msgpack-python-2.4.1/umsgpack.py $(pysite)
-	
-	# cffi (cryptography prereq)
-	$(call get_src_pypi,5e/67/01ae6ae50d168d3b92f2a80bf62e07537171d0a1938c8bceb7e64d36829f,cffi-1.11.2-cp27-cp27m-win32.whl)\
-	unzip -d $(tmp) $$dld 
-	cp -R $(tmp)/cffi $(tmp)/_cffi_backend.pyd $(pysite)
-	
-	# Twisted
-	$(call get_src_pypi,fe/cb/97504d68c2f4300fb121f700cc2fae10e1856ba043e964acfab02e120835,Twisted-17.9.0-cp27-cp27m-win32.whl)\
-	unzip -d $(tmp) $$dld 
-	cp -R $(tmp)/twisted $(pysite)
-	
-	# Autobahn
-	$(call get_src_pypi,e4/2e/01a64212b1eb580d601fa20f146c962235e3493795f46e3b254597ec635d,autobahn-17.10.1.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/autobahn-17.10.1/autobahn $(pysite)
-	
-	# Nevow
-	$(call get_src_pypi,source/N/Nevow,Nevow-0.10.0.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	for i in nevow formless twisted; do cp -R $(tmp)/Nevow-0.10.0/$$i $(pysite); done
-	
-	# Numpy
-	$(call get_src_pypi,fd/32/196073188f5b8b464e0fabb470f971fa5dcd91b55726a43b40b008212358,numpy-1.13.3-2-cp27-none-win32.whl)\
-	unzip -d $(tmp) $$dld
-	cp -R $(tmp)/numpy $(pysite)
-	
-	# SimpleJson
-	$(call get_src_pypi,source/s/simplejson,simplejson-2.2.1.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cp -R $(tmp)/simplejson-2.2.1/simplejson/ $(pysite)
-	
-	# Zeroconf
-	$(call get_src_pypi,6b/88/48dbe88b10098f98acef33218763c5630b0081c7fd0849ab4793b1e9b6d3,zeroconf-0.19.1-py2.py3-none-any.whl)\
-	unzip -d $(tmp)/zeroconf $$dld
-	cp -R $(tmp)/zeroconf/*.py* $(pysite)
-	
-	# netifaces
-	$(call get_src_pypi,05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129,netifaces-0.10.6-py2.7-win32.egg)\
-	unzip -d $(tmp)/netifaces $$dld
-	cp -R $(tmp)/netifaces/*.py* $(pysite)	
-	
-	# WxGlade
-	$(call get_src_http,https://bitbucket.org/wxglade/wxglade/get,034d891cc947.zip)\
-	unzip -d $(tmp) $$dld
-	mv $(tmp)/wxglade-wxglade-034d891cc947 $(pysite)/wxglade
-	
-	# Pyro
-	$(call get_src_pypi,61/68/0978adae315261b87acd216517c2c7f00780396e4d1426c5412458c6a28f,Pyro-3.16.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	mv $(tmp)/Pyro-3.16/Pyro $(pysite)
-	
-	# Lxml
-	$(call get_src_pypi,c7/e6/26a600d9828554ca9de35d3d1daf3779028bea37025f3dd25e9d58d63bac,lxml-4.1.1-cp27-cp27m-win32.whl)\
-	unzip -d $(tmp) $$dld
-	cp -R $(tmp)/lxml $(pysite)
-	
-	touch $@
-
-	
-OSSLVER=openssl-1.0.1p
-MINGPFX=i686-w64-mingw32-
-
-openssl:
-	# Build Openssl
-	$(call get_src_http,https://openssl.org/source,$(OSSLVER).tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cd $(tmp)/$(OSSLVER); \
-	CC=$(MINGPFX)gcc ./Configure mingw && \
-	make all build-shared CROSS_COMPILE=$(MINGPFX) SHARED_LDFLAGS=-static-libgcc
-	mv $(tmp)/$(OSSLVER) .;
-	
-	touch $@
-	
-M2CRVER=M2Crypto-0.22.5
-
-m2crypto: openssl
-	# Build M2crypto
-	$(call get_src_pypi,54/f5/6fa9bca4a18cc36c0c84c73d41d8e521c8cb70f077b11297efcd985242a6,M2Crypto-0.22.5.tar.gz)\
-	tar -C $(tmp) -xzf $$dld
-	cd $(tmp)/$(M2CRVER); \
-	patch -p1 < $(src)/M2Crypto-mingw-cross-compile-fix.patch && \
-	PYTHONLIB=$(abspath $(pydir))/libs \
-	PYTHONINC=$(abspath $(pydir))/include/ \
-	MINGCCPREFIX=$(MINGPFX) \
-	    python setup.py build build_ext \
-	        --openssl=$(CURDIR)/$(OSSLVER) -cmingw32
-	
-	# Copy openssl dlls directly in M2Crypto package directory
-	cp -a $(CURDIR)/$(OSSLVER)/*.dll $(tmp)/$(M2CRVER)/build/lib.win32-2.7/M2Crypto 
-	
-	# Move result into python site packages
-	mv $(tmp)/$(M2CRVER)/build/lib.win32-2.7/M2Crypto $(pysite)
-	
-	touch $@
-
-matiecdir = build/matiec
-matiec: |build
-	$(call get_src_hg,$(tmp)/matiec)
-	cd $(tmp)/matiec ;\
-	autoreconf;\
-	automake --add-missing;\
-	./configure --host=$(CROSS_COMPILE);\
-	make -j$(CPUS);
-	rm -rf $(matiecdir)
-	mkdir -p $(matiecdir)
-	mv $(tmp)/matiec/*.exe $(matiecdir)
-	
-	# install necessary shared libraries from local cross-compiler
-	$(call get_runtime_libs,$(matiecdir))
-	
-	mv $(tmp)/matiec/lib $(matiecdir)
-	touch $@
-
-examples: |build
-	rm -rf  examples
-	mkdir -p examples
-
-beremiz: | build examples
-	$(call get_src_hg,build/beremiz)
-	$(call tweak_beremiz_source)
-	rm -rf examples/canopen_tests
-	mkdir -p examples/canopen_tests
-	mv build/beremiz/tests/canopen_* examples/canopen_tests
-	rm -rf examples/base_tests
-	mkdir -p examples/base_tests
-	mv build/beremiz/tests/* examples/base_tests
-	touch $@
-
-CFbuild = build/CanFestival-3
-CFconfig = $(CFbuild)/objdictgen/canfestival_config.py
-canfestival: mingw
-	rm -rf $(CFbuild)
-	$(call get_src_hg,$(CFbuild))
-	cd $(CFbuild); \
-	./configure --can=tcp_win32 \
-				--cc=$(CC) \
-				--cxx=$(CXX) \
-				--target=win32 \
-				--wx=0
-	$(MAKE) -C $(CFbuild)
-	cd $(CFbuild); find . -name "*.o" -exec rm {} ';' #remove object files only
-	touch $@
-
-targets=python m2crypto mingw matiec beremiz
-Beremiz-$(version).exe: $(targets) $(src)/license.txt $(src)/install.nsi $(targets_ex)
-	sed -e 's/\$$BVERSION/$(version)/g' $(src)/license.txt > build/license.txt
-	sed -e 's/\$$BVERSION/$(version)/g' $(src)/install.nsi |\
-	sed -e 's/\$$BEXTENSIONS/$(extensions)/g' |\
-        makensis -
-
-clean_installer:
-	rm -rf build Beremiz-$(version).exe $(targets) $(targets_ex)
+revisions.txt: $(src)/revisions.txt own_sources
+	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'
 
 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,98 @@
+# Beremiz public distribution #
+
+This repository holds recipes and patches to build the Beremiz related 
+bundles, packages, installers and images available on 
+[Beremiz website](http://www.beremiz.org/).
+
+Patches have same license as projects beeing patched. For other files,
+unless made explicit in file header, GPLv3 applies.
+
+
+## Prerequisites ##
+
+A usable Docker is required. Docker is used to ensure a reproducible build
+environment. 
+
+Other containerization/virtualization could be used to achieve the same effect. 
+
+Reference build environment is obtained by applying [provision_focal64.sh](provision_focal64.sh) on Ubuntu 20.04 amd64.
+
+## Build ##
+
+The top Makefile expects source code of Beremiz, Matiec and CanFestival to be 
+sibling to beremiz_public_dist directory, in the 'source directory'.
+For example :
+
+```
+~/src
+     /beremiz
+     /beremiz_public_dist
+     /CanFestival-3
+     /matiec
+```
+
+If any of Beremiz, Matiec or CanFestival repositories are missing, they will be
+cloned aside beremiz_public_dist from https://hg.beremiz.org .
+
+Intermediate and final results are all placed in a single 'build directory'
+during build process.
+
+### Prepare Docker image ###
+
+The script [rebuild_docker.sh](rebuild_docker.sh) is used for that purpose.
+
+Synopsis:
+
+    ./rebuild_docker.sh [build directory]
+
+Example:
+
+```
+#!sh
+mkdir ~/src
+cd ~/src
+hg clone https://hg.beremiz.org/beremiz_public_dist
+cd beremiz_public_dist
+./rebuild_docker.sh
+```
+
+Source and Build Volumes :
+ 
+ Role             | Docker Volume     | Host path in example | Rationale
+------------------|-------------------|----------------------|------------------------------------------------
+ source directory | /home/devel/src   | ~/src                | Always relative to CWD : "../"
+ build directory  | /home/devel/build | ~/build              | First argument to rebuild_docker.sh or ~/build
+
+'build directory' can be specified as absolute path argument of rebuild_docker.sh.
+If not specified it defaults to ~/build
+
+```
+#!sh
+./rebuild_docker.sh ~/build_next
+```
+
+Note: 'build directory' is created if not already existing.
+
+### Build Windows Installer ###
+
+The script [build_in_docker.sh](build_in_docker.sh) is used for that purpose.
+
+```
+#!sh
+./build_in_docker.sh 
+```
+
+Note: 'build directory' must exist before calling build_in_docker.sh, otherwise
+Docker will create it as root user. Be sure to create it again if you delete it.
+
+Resulting installer is Beremiz-1.2.exe in 'build directory'. 
+
+## Manhole ##
+
+Once Docker image ready, the scripts [enter_docker.sh](enter_docker.sh) and
+[enter_docker_as_root.sh](enter_docker_as_root.sh) let you issue build 
+commands, or install additional packages.
+
+[clean_docker_container.sh](clean_docker_container.sh) and [create_docker_container.sh](create_docker_container.sh) and 
+[clean_docker_image.sh](clean_docker_image.sh) and [build_docker_image.sh](build_docker_image.sh) are invoked by 
+[rebuild_docker.sh](rebuild_docker.sh). 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build_docker_image.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+set -e
+
+OWNDIRBASENAME=$(basename $(cd $(dirname "${BASH_SOURCE[0]}") && pwd))
+
+echo "Building docker image"
+docker build \
+    --build-arg UID=$(id -u) \
+    --build-arg GID=$(id -g) \
+    --build-arg OWNDIRBASENAME="$OWNDIRBASENAME" \
+    -t beremiz_public_builder .
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build_in_docker.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+CONTAINER=beremiz_public_builder_current
+
+docker start $CONTAINER 
+docker exec -i -t $CONTAINER bash -i -c build $1
+docker stop $CONTAINER
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/clean_docker_container.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# delete container
+docker rm beremiz_public_builder_current
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/clean_docker_image.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# delete image
+docker rmi beremiz_public_builder
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/create_docker_container.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -e
+
+# absolute path to directory containing parent directory of that script
+# (i.e. source directory containing beremiz, matiec, etc..)
+SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
+echo "SOURCE direcory : $SRCDIR"
+
+# absolute path to build directory. ~/build if not given as only argument
+BUILDDIR=${1:-~/build}
+mkdir -p $BUILDDIR
+echo "BUILD direcory : $BUILDDIR"
+
+UNAME=devel
+UHOME=/home/$UNAME
+
+echo "Creating docker container"
+docker create \
+       --name beremiz_public_builder_current \
+       -v $SRCDIR:$UHOME/src \
+       -v $BUILDDIR:$UHOME/build \
+       -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \
+       -w $UHOME/build \
+       -i -t beremiz_public_builder /bin/bash
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/distfiles/python-2.7.13.msi.md5	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,1 @@
+0f057ab4490e63e528eaa4a70df711d9  python-2.7.13.msi
--- a/enter_docker.sh	Sun Dec 17 01:29:32 2017 +0100
+++ b/enter_docker.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-# this script is given as an exemple
-# I use it to have a shell running in ready-to-build container
-# obtained with rebuild_docker.sh
+CNT=beremiz_public_builder_current
 
-docker start -i current
+docker start -i $CNT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/enter_docker_as_root.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+CONTAINER=beremiz_public_builder_current
+
+docker start $CONTAINER
+docker exec -i -t -u root $CONTAINER bash
+docker stop $CONTAINER
--- a/install.nsi	Sun Dec 17 01:29:32 2017 +0100
+++ b/install.nsi	Sat Sep 04 01:35:11 2021 +0200
@@ -1,11 +1,12 @@
 
-SetCompressor /SOLID /FINAL lzma
+;SetCompressor /SOLID /FINAL lzma
+SetCompress off
 SetDatablockOptimize off
 
 !include MUI2.nsh
 
 ; MUI Settings
-!define MUI_ICON "build\beremiz\images\brz.ico"
+!define MUI_ICON "installer\beremiz\images\brz.ico"
 !define MUI_HEADERIMAGE
 !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" ; optional
 !define MUI_ABORTWARNING
@@ -13,7 +14,7 @@
 ; Documentation
 !insertmacro MUI_PAGE_WELCOME
 !define MUI_LICENSEPAGE_CHECKBOX
-!insertmacro MUI_PAGE_LICENSE "build/license.txt"
+!insertmacro MUI_PAGE_LICENSE "installer/license.txt"
 !insertmacro MUI_PAGE_DIRECTORY
 !insertmacro MUI_PAGE_INSTFILES
 !insertmacro MUI_PAGE_FINISH
@@ -27,18 +28,11 @@
 OutFile "Beremiz-$BVERSION.exe"
 InstallDir "$PROGRAMFILES\Beremiz"
 !define PYTHONW_EXE "$INSTDIR\python\pythonw.exe"
-!define BEREMIZ_EXE '"$INSTDIR\beremiz\Beremiz.py" -u "http://www.beremiz.org/updateinfo/$BVERSION/" $BEXTENSIONS'
+!define BEREMIZ_EXE '"$INSTDIR\beremiz\Beremiz.py" -u "http://www.beremiz.org/updateinfo/$BVERSION/"'
 
 Section "Beremiz" 
   SetOutPath $INSTDIR
-  File /r /x debian /x *.pyc "build/*"
-SectionEnd
-
-Section "Examples" 
-  CreateDirectory "$DESKTOP\BeremizExamples"
-  SetOutPath "$DESKTOP\BeremizExamples"
-  File /r "examples/*"
-  CreateShortCut "$DESKTOP\BeremizExamples\canopen_tests\CAN_TCP_Server.lnk" "$INSTDIR\CanFestival-3\drivers\can_tcp_win32\can_tcp_win32_server.exe" "" "" 0 SW_SHOWNORMAL "" "Simple CAN emulation over TCP (for CANopen testing)"
+  File /r /x debian /x *.pyc "installer/*"
 SectionEnd
 
 Section "Install"
@@ -56,7 +50,7 @@
 Section "Shortcuts"
   SetShellVarContext all
   CreateDirectory "$SMPROGRAMS\Beremiz"
-  SetOutPath "$INSTDIR\mingw\bin"
+  SetOutPath "$INSTDIR\msys32\bin"
   CreateShortCut "$SMPROGRAMS\Beremiz\PlcopenEditor.lnk" "${PYTHONW_EXE}" '"$INSTDIR\beremiz\plcopeneditor.py"' "$INSTDIR\beremiz\images\poe.ico"
   CreateShortCut "$SMPROGRAMS\Beremiz\Beremiz.lnk" "${PYTHONW_EXE}" '${BEREMIZ_EXE}' "$INSTDIR\beremiz\images\brz.ico"
   CreateShortCut "$SMPROGRAMS\Beremiz\Uninstall.lnk" "$INSTDIR\uninstall.exe"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pacman-6.0.0-nogpg-relative_conf.patch	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,48 @@
+Binary files pacman-6.0.0.orig/lib/libalpm/.dload.c.swp and pacman-6.0.0/lib/libalpm/.dload.c.swp differ
+Binary files pacman-6.0.0.orig/lib/libalpm/.error.c.swp and pacman-6.0.0/lib/libalpm/.error.c.swp differ
+Binary files pacman-6.0.0.orig/lib/libalpm/.hook.c.swp and pacman-6.0.0/lib/libalpm/.hook.c.swp differ
+Binary files pacman-6.0.0.orig/lib/libalpm/.trans.c.swp and pacman-6.0.0/lib/libalpm/.trans.c.swp differ
+diff -ruN pacman-6.0.0.orig/lib/libalpm/util.c pacman-6.0.0/lib/libalpm/util.c
+--- pacman-6.0.0.orig/lib/libalpm/util.c	2021-05-20 03:38:45.948119900 +0000
++++ pacman-6.0.0/lib/libalpm/util.c	2021-08-26 17:26:09.719703392 +0000
+@@ -652,6 +652,11 @@
+ 		/* use fprintf instead of _alpm_log to send output through the parent */
+ 		if(chroot(handle->root) != 0) {
+ 			fprintf(stderr, _("could not change the root directory (%s)\n"), strerror(errno));
++			fprintf(stderr, "cmd : %s", cmd);
++			for(int i=0; argv[i]; i++){
++				fprintf(stderr, " %s", argv[i]);
++			}
++			fprintf(stderr, "\n");
+ 			exit(1);
+ 		}
+ 		if(chdir("/") != 0) {
+Binary files pacman-6.0.0.orig/lib/libalpm/.util.c.swp and pacman-6.0.0/lib/libalpm/.util.c.swp differ
+Binary files pacman-6.0.0.orig/.meson.build.swp and pacman-6.0.0/.meson.build.swp differ
+diff -ruN pacman-6.0.0.orig/src/pacman/conf.c pacman-6.0.0/src/pacman/conf.c
+--- pacman-6.0.0.orig/src/pacman/conf.c	2021-05-20 03:38:45.964786500 +0000
++++ pacman-6.0.0/src/pacman/conf.c	2021-08-26 17:27:32.228666450 +0000
+@@ -477,7 +477,7 @@
+ 		}
+ 
+ 		/* now parse out and store actual flag if it is valid */
+-		if(strcmp(value, "Never") == 0) {
++		if(1 || strcmp(value, "Never") == 0) {
+ 			if(package) {
+ 				SLUNSET(ALPM_SIG_PACKAGE);
+ 			}
+@@ -1071,9 +1071,11 @@
+ 			break;
+ 		default:
+ 			for(gindex = 0; gindex < globbuf.gl_pathc; gindex++) {
++				char buf[1024];
++				snprintf(buf, 1023, "%s%s",ROOTDIR, globbuf.gl_pathv[gindex]);
+ 				pm_printf(ALPM_LOG_DEBUG, "config file %s, line %d: including %s\n",
+-						file, linenum, globbuf.gl_pathv[gindex]);
+-				ret = parse_ini(globbuf.gl_pathv[gindex], _parse_directive, data);
++						file, linenum, buf);
++				ret = parse_ini(buf, _parse_directive, data);
+ 				if(ret) {
+ 					goto cleanup;
+ 				}
+Binary files pacman-6.0.0.orig/src/pacman/.conf.c.swp and pacman-6.0.0/src/pacman/.conf.c.swp differ
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/provision_focal64.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,79 @@
+#!/usr/bin/env bash
+
+# This script is to be executed as root to provision necessary stuff
+# to run distribution build on a blank Ubuntu Focal 64 image
+
+set -xe
+dpkg --add-architecture i386
+
+apt-get update
+
+apt-get install -y locales
+
+locale-gen en_US.UTF-8
+
+TZ="America/Paris" \
+DEBIAN_FRONTEND="noninteractive" \
+apt-get install -y --no-install-recommends \
+     autoconf                   \
+     automake                   \
+     bc                         \
+     bison                      \
+     build-essential            \
+     ca-certificates            \
+     cpio                       \
+     cmake                      \
+     fakeroot                   \
+     file                       \
+     flex                       \
+     gettext                    \
+     gawk                       \
+     git                        \
+     gperf                      \
+     gcc-multilib               \
+     g++-multilib               \
+     help2man                   \
+     less                       \
+     libarchive-dev             \
+     libcurl4-openssl-dev       \
+     libssl-dev                 \
+     libtool                    \
+     libtool-bin                \
+     lzma                       \
+     make                       \
+     mercurial                  \
+     meson                      \
+     mingw-w64                  \
+     ncurses-dev                \
+     nsis                       \
+     rsync                      \
+     pkg-config                 \
+     python                     \
+     python-dev                 \
+     python3-distutils          \
+     subversion                 \
+     swig                       \
+     texinfo                    \
+     unrar                      \
+     unzip                      \
+     wget                       \
+     xvfb                       \
+     zip
+
+
+## for winehq-staging
+#     gnupg                      \
+#     libgpgme-dev               \
+#     software-properties-common \
+# wget -nc https://dl.winehq.org/wine-builds/winehq.key
+# apt-key add winehq.key
+# add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
+# apt-get update
+
+echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
+echo ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note | debconf-set-selections
+
+apt-get install -y --install-recommends \
+     wine-stable winbind
+
+apt-get clean -y
--- a/provision_xenial64.sh	Sun Dec 17 01:29:32 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-
-# This script is to be executed as root to provision necessary stuff
-# to run distribution build on a blank Ubuntu Xenial 64 image
-
-set -xe
-dpkg --add-architecture i386
-apt-get update
-
-apt-get install -y --no-install-recommends \
-     autoconf        \
-     automake        \
-     bison           \
-     build-essential \
-     ca-certificates \
-     flex            \
-     gettext         \
-     git             \
-     lzma            \
-     make            \
-     mercurial       \
-     mingw-w64       \
-     nsis            \
-     swig            \
-     texinfo         \
-     unrar           \
-     unzip           \
-     wget            \
-     xvfb
-
-     echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
-     echo ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note | debconf-set-selections
-
-apt-get install -y --install-recommends \
-     wine
-
-apt-get clean -y
--- a/public.mk	Sun Dec 17 01:29:32 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-
-targets_ex+= canfestival
-
-
--- a/rebuild_docker.sh	Sun Dec 17 01:29:32 2017 +0100
+++ b/rebuild_docker.sh	Sat Sep 04 01:35:11 2021 +0200
@@ -1,16 +1,9 @@
 #!/bin/bash
 
-# this script is given as an exemple
-# I use it to prepare a ready-to-build container
-# and then use that container with enter_docker.sh
+set -e
 
-docker rm current
-docker rmi beremiz_builder
-docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t beremiz_builder .
-docker create \
-       --name current \
-       -v ~/src:/home/devel/src \
-       -v ~/build/:/home/devel/build \
-       -v ~/.bash_history:/home/devel/.bash_history \
-       -w /home/devel/build \
-       -i -t beremiz_builder /bin/bash
+./clean_docker_container.sh || true
+./clean_docker_image.sh || true
+./build_docker_image.sh
+./create_docker_container.sh $1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/revisions.txt	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,4 @@
+beremiz tip
+CanFestival-3 tip
+Modbus tip
+matiec tip
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/win32.mk	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,21 @@
+# Win32 only distribution
+
+OWN_PROJECTS_EX=CanFestival-3
+
+ide_targets_from_dist: canfestival
+	touch $@
+
+CFbuild = installer/CanFestival-3
+canfestival: $(msysdir)/.stamp
+	rm -rf $(CFbuild)
+	$(call get_src_hg,$(CFbuild))
+	cd $(CFbuild); \
+	./configure --can=tcp_win32 \
+				--cc=$(CC) \
+				--cxx=$(CXX) \
+				--target=win32 \
+				--wx=0
+	$(MAKE) -C $(CFbuild)
+	cd $(CFbuild); find . -name "*.o" -exec rm {} ';' #remove object files only
+	touch $@
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windows_installer.mk	Sat Sep 04 01:35:11 2021 +0200
@@ -0,0 +1,144 @@
+TIMESTAMP=$(shell date '+%y.%m.%d')
+
+CROSS_COMPILE=i686-w64-mingw32
+CROSS_COMPILE_LIBS_DIR=$(shell dirname $(shell $(CROSS_COMPILE)-gcc -print-libgcc-file-name))
+CC=$(CROSS_COMPILE)-gcc
+CXX=$(CROSS_COMPILE)-g++
+
+installer:
+	mkdir -p installer
+
+
+CURDIR:=$(shell pwd)
+PACMANPFX=$(CURDIR)/pacman
+msysdir=installer/msys32
+MSYS_ROOT=$(CURDIR)/$(msysdir)
+
+pacman/.stamp: | installer
+	rm -rf pacman pacman-6.0.0
+	$(call get_src_http,https://sources.archlinux.org/other/pacman,pacman-6.0.0.tar.xz)\
+	tar -xJf $$dld
+	cd pacman-6.0.0 ;\
+	patch -p1 < $(src)/pacman-6.0.0-nogpg-relative_conf.patch ;\
+	meson -Droot-dir=$(MSYS_ROOT) -Dsysconfdir=$(MSYS_ROOT)/etc -Dlocalstatedir=$(MSYS_ROOT)/var build ;\
+	DESTDIR=$(PACMANPFX) ninja -C build install
+	touch $@
+
+define pacman_install
+LD_LIBRARY_PATH=$(PACMANPFX)/usr/lib/x86_64-linux-gnu/ fakeroot pacman/usr/bin/pacman -S $(1) --arch i686 --noconfirm -cachedir $(distfiles)
+endef
+
+$(msysdir)/.stamp: pacman/.stamp | installer
+	rm -rf installer/msys32
+	$(call get_src_http,http://repo.msys2.org/distrib/i686,msys2-base-i686-20210705.tar.xz)\
+	tar -C installer -xJf $$dld
+	$(call pacman_install, mingw-w64-i686-gcc)
+	$(call pacman_install, make)
+	touch $@
+
+
+msiexec = WINEPREFIX=$(tmp) $(XVFBRUN) msiexec
+wine = WINEPREFIX=$(tmp) $(XVFBRUN) wine
+pydir = installer/python
+pysite = $(pydir)/Lib/site-packages
+
+python: $(pydir)/.stamp
+$(pydir)/.stamp: | installer
+	rm -rf $(pydir)
+	mkdir -p $(pydir)
+	
+	# Python
+	$(call get_src_http,http://www.python.org/ftp/python/2.7.13,python-2.7.13.msi)\
+	$(msiexec) /qn /i $$dld TARGETDIR=.\\$(pydir)
+	
+	# # wxPython fails if VC9.0 redistribuable is not fully here.
+	# $(call get_src_http,http://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140,vcredist_x86.exe)\
+	# cp $$dld $(tmp)
+	# $(wine) $(tmp)/vcredist_x86.exe /qn /i
+	# cp -fu $(tmp)/drive_c/windows/winsxs/x86_microsoft.vc90*/* $(pydir)
+	
+	$(wine) $(pydir)/python.exe -m pip install --only-binary :all: --cache-dir $(distfiles) \
+        wxPython            \
+        future              \
+        matplotlib          \
+        pywin32             \
+        twisted             \
+        pyOpenSSL           \
+        Nevow               \
+        autobahn            \
+        msgpack_python      \
+        u-msgpack-python    \
+        zeroconf=0.20.0     \
+        lxml                \
+        sslpsk              \
+        pycountry           \
+        fonttools           \
+        Brotli
+	
+	$(wine) $(pydir)/python.exe -m pip install --cache-dir $(distfiles) \
+        Pyro                \
+        gnosis              
+	
+	# # service identity (twisted prereq) ?
+	# # python sslpsk (to have PYROPSK)
+	# # FIXME : this uses 'some' binaries of openssl that forces us to stick to python 2.7.13
+	# # FIXME : (from here : https://www.npcglib.org/~stathis/blog/precompiled-openssl/)
+	# # FIXME : build it, and use openssl binaries from https://github.com/python/cpython-bin-deps/tree/openssl-bin-1.0.2k
+	# WxGlade
+	$(call get_src_http,https://github.com/wxGlade/wxGlade/archive,v0.8.3.zip)\
+	unzip -d $(tmp) $$dld
+	mv $(tmp)/wxGlade-0.8.3 $(pysite)/wxglade
+	
+	touch $@
+
+matiecdir = installer/matiec
+matiec: $(matiecdir)/.stamp
+$(matiecdir)/.stamp: sources/matiec_src | installer
+	cp -a sources/matiec $(tmp);\
+	cd $(tmp)/matiec;\
+	autoreconf;\
+	automake --add-missing;\
+	./configure --host=$(CROSS_COMPILE);\
+	make -j$(CPUS);
+	rm -rf $(matiecdir)
+	mkdir -p $(matiecdir)
+	mv $(tmp)/matiec/*.exe $(matiecdir)
+	
+	# install necessary shared libraries from local cross-compiler
+	cp $(CROSS_COMPILE_LIBS_DIR)/libgcc_s_sjlj-1.dll $(matiecdir)
+	cp $(CROSS_COMPILE_LIBS_DIR)/libstdc++-6.dll $(matiecdir)
+	
+	mv $(tmp)/matiec/lib $(matiecdir)
+	touch $@
+
+beremizdir = installer/beremiz
+
+beremiz: $(beremizdir)/.stamp
+$(beremizdir)/.stamp:  sources/beremiz_src | installer
+	rm -rf $(beremizdir);\
+	cp -a sources/beremiz $(beremizdir);\
+	touch $@
+
+ide_revisions = installer/revisions.txt
+$(ide_revisions): revisions.txt
+	cp $< $@ 
+
+Beremiz-build: Beremiz-$(TIMESTAMP)_build
+Beremiz-$(TIMESTAMP)_build: $(msysdir)/.stamp $(pydir)/.stamp $(matiecdir)/.stamp $(beremizdir)/.stamp ide_targets_from_dist $(ide_revisions)
+	touch $@
+
+Beremiz-archive: Beremiz-$(TIMESTAMP).zip
+
+Beremiz-installer: Beremiz-$(TIMESTAMP).exe
+
+Beremiz-$(TIMESTAMP).zip: Beremiz-$(TIMESTAMP)_build
+	rm -f $@
+	cd installer; zip -r -q ../$@ .
+
+Beremiz-$(TIMESTAMP).exe: Beremiz-$(TIMESTAMP)_build $(src)/license.txt $(src)/install.nsi 
+	sed -e 's/\$$BVERSION/$(TIMESTAMP)/g' $(src)/license.txt > installer/license.txt
+	sed -e 's/\$$BVERSION/$(TIMESTAMP)/g' $(src)/install.nsi |\
+	makensis -
+
+
+