windows_installer.mk
author Edouard Tisserant <edouard.tisserant@gmail.com>
Mon, 23 Oct 2023 10:40:39 +0200
changeset 126 a7809f76f626
parent 120 02e37d9e96a9
permissions -rw-r--r--
GitHub CI: beremiz revsion bump
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
installer:
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
	mkdir -p installer
116
dc462ee1c0f5 Windows installer: add winpaths.py to extend %PATH% so that build find msys2 binaries including Make.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
     4
	cp $(src)/winpaths.py installer
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
CURDIR:=$(shell pwd)
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
PACMANPFX=$(CURDIR)/pacman
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
     9
MSYS_DIR=msys64
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    10
MSYS_ENV_DIR=ucrt64
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    11
MSYS_ENV=mingw-w64-ucrt-x86_64
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    12
MSYS_ROOT=$(CURDIR)/$(MSYS_DIR)
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
94
6d390b2623f5 re-starting xvfb-run too fast makes problems. Trying with -a
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 79
diff changeset
    14
XVFBRUN ?= xvfb-run -a
79
a8b434605895 Add Snap Package.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 40
diff changeset
    15
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    16
msysfinaldir=installer/$(MSYS_DIR)
38
3991f82369cb Bundle in installer only fraction of MSYS2: Mingw32. The rest isn't needed for now.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 37
diff changeset
    17
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    18
pacman-6.0.0/src.stamp:
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
	rm -rf pacman pacman-6.0.0
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    20
	$(call get_src_http,https://sources.archlinux.org/other/pacman,pacman-6.0.0.tar.xz)\
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    21
	tar -xJf $$dld
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    22
	touch $@
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    23
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    24
pacman-6.0.0/patched.stamp: pacman-6.0.0/src.stamp
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    25
	cd pacman-6.0.0 ;\
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    26
	patch -p1 < $(src)/pacman-6.0.0-nogpg-relative_conf.patch ;
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    27
	touch $@
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    28
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    29
pacman/.stamp: pacman-6.0.0/patched.stamp
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    30
	cd pacman-6.0.0 ;\
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    31
	meson -Droot-dir=$(MSYS_ROOT) -Dsysconfdir=$(MSYS_ROOT)/etc -Dlocalstatedir=$(MSYS_ROOT)/var build ;\
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    32
	DESTDIR=$(PACMANPFX) ninja -C build install
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    33
	touch $@
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    34
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    35
define pacman_call
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    36
LD_LIBRARY_PATH=$(PACMANPFX)/usr/lib/x86_64-linux-gnu/ fakeroot pacman/usr/bin/pacman $(1)
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    37
endef
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    38
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    39
pacman_update=$(call pacman_call, -Sy --noconfirm --cachedir $(distfiles));
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    40
pacman_install_ming=$(call pacman_call, -S $(1) --arch x86_64 --noconfirm --cachedir $(distfiles));
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    41
pacman_install_msys=$(call pacman_call, -S $(1) --noconfirm --cachedir $(distfiles));
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    42
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    43
# First part are python packages requested by our app and available in msys
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    44
# Second part are dependencies of packages to be later installed with pip
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    45
# Third part : neede for cross-install operation
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    46
#    -> all those packages are installed with pacman, ignoring version given in requirements.txt
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    47
define MSYS_PY_PACKAGES
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    48
	brotli
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    49
	click
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    50
	fonttools
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    51
	lxml
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    52
	matplotlib
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    53
	msgpack
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    54
	pycountry
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    55
	u-msgpack
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    56
	zeroconf
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    57
	twisted
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    58
	
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    59
	cryptography
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    60
	aiosqlite
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    61
	pytz
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    62
	sortedcontainers
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    63
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    64
	pip
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    65
endef
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    66
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    67
define MSYS_PACKAGES_NAMES
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    68
	gcc
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    69
	make
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    70
	wxPython
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    71
	$(foreach package, $(MSYS_PY_PACKAGES), python-$(package))
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    72
endef
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    73
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    74
MSYS_PACKAGES=$(foreach package, $(MSYS_PACKAGES_NAMES), $(MSYS_ENV)-$(package))
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    75
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    76
$(MSYS_DIR)/.stamp: pacman/.stamp 
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    77
	rm -rf $(MSYS_DIR)
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    78
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    79
	$(call get_src_http,https://repo.msys2.org/distrib/x86_64,msys2-base-x86_64-20230718.tar.xz)\
38
3991f82369cb Bundle in installer only fraction of MSYS2: Mingw32. The rest isn't needed for now.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 37
diff changeset
    80
	tar -xJf $$dld
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    81
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    82
	# Do NOT update package lists to make build reproducible
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    83
	# All packages version are as given in base image.
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    84
	## $(pacman_update)	
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    85
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    86
	$(call pacman_install_ming,$(MSYS_PACKAGES))
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    87
	touch $@
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    88
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    89
# filter-out all python packages already installed by pacman
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    90
filtered_requirements.txt: $(MSYS_DIR)/.stamp sources/beremiz_src
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    91
	grep sources/beremiz/requirements.txt -i -v \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    92
		`$(call pacman_call, -Qqs 'python-.*') | sed -e 's/$(MSYS_ENV)-python-/ -e /'` \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    93
		-e wxPython \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    94
		$(foreach package, $(MSYS_PY_PACKAGES), -e $(package)) > filtered_requirements.txt
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    95
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    96
# download remaining pip packages separtately with local python
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    97
# workaround msys2's git crashing when launched from pip on wine
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    98
# bug: https://bugs.winehq.org/show_bug.cgi?id=40528
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
    99
pip_downloads/.stamp: filtered_requirements.txt
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   100
	rm -rf pip_downloads
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   101
	# python3 -m pip download --no-deps -r filtered_requirements.txt -d pip_downloads
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   102
	python3 -m pip wheel --no-deps -r filtered_requirements.txt -w pip_downloads
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   103
	touch $@
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   104
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   105
# install downloaded .whl files with wine
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   106
# TODO: find a less convoluited way instead of wine to unpack wheels
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   107
#       but still populating __pycache__ for this particular python version
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   108
winpythonbin = $(MSYS_ROOT)/$(MSYS_ENV_DIR)/bin/python.exe
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   109
wine = WINEPREFIX=$(tmp) $(XVFBRUN) wine
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   110
pip.stamp: pip_downloads/.stamp
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   111
	cd pip_downloads; $(wine) $(winpythonbin) -m pip install --no-deps *
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   112
	touch $@
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   113
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   114
$(msysfinaldir)/.stamp: pip.stamp | installer
116
dc462ee1c0f5 Windows installer: add winpaths.py to extend %PATH% so that build find msys2 binaries including Make.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
   115
	rm -rf $(msysfinaldir)
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   116
	cp -a $(MSYS_DIR) $(msysfinaldir)
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   117
	touch $@
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   118
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   119
CROSS_COMPILE=x86_64-w64-mingw32
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   120
CROSS_COMPILE_LIBS_DIR=$(shell dirname $(shell $(CROSS_COMPILE)-gcc -print-libgcc-file-name))
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   121
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   122
matiecdir = installer/matiec
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   123
matiec: $(matiecdir)/.stamp
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   124
$(matiecdir)/.stamp: sources/matiec_src | installer
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   125
	cp -a sources/matiec $(tmp);\
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   126
	cd $(tmp)/matiec;\
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   127
	autoreconf ;\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   128
	automake --add-missing ;\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   129
	LDFLAGS=-lstdc++ ./configure --host=$(CROSS_COMPILE);\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   130
	$(MAKE) -j$(CPUS);
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   131
	rm -rf $(matiecdir)
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   132
	mkdir -p $(matiecdir)
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   133
	mv $(tmp)/matiec/*.exe $(matiecdir)
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   134
	
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   135
	# install necessary shared libraries from local cross-compiler
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   136
	cp $(CROSS_COMPILE_LIBS_DIR)/libgcc_s_seh-1.dll $(matiecdir)
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   137
	cp $(CROSS_COMPILE_LIBS_DIR)/libstdc++-6.dll $(matiecdir)
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   138
	
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   139
	mv $(tmp)/matiec/lib $(matiecdir)
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   140
	touch $@
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   141
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   142
beremizdir = installer/beremiz
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   143
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   144
beremiz: $(beremizdir)/.stamp
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   145
$(beremizdir)/.stamp:  sources/beremiz_src | installer
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   146
	rm -rf $(beremizdir);\
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   147
	cp -a sources/beremiz $(beremizdir);\
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   148
	# populate __pycache__'s .pyc files
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   149
	cd $(beremizdir) ;\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   150
		find . -name "*.py" | grep -v \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   151
			-e \./etherlab \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   152
			-e .*/web_settings.py \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   153
			-e \./tests \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   154
			-e \./exemples \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   155
			> tocompile.lst ;\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   156
		$(wine) $(winpythonbin) -m compileall -i tocompile.lst
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   157
	rm $(beremizdir)/tocompile.lst
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   158
	touch $@
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   159
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   160
ide_revisions = installer/revisions.txt
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   161
$(ide_revisions): revisions.txt
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   162
	cp $< $@ 
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   163
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   164
Beremiz-windows-build: $(msysfinaldir)/.stamp pip.stamp $(matiecdir)/.stamp $(beremizdir)/.stamp ide_targets_from_dist $(ide_revisions)
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   165
	touch $@
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   166
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   167
Beremiz-portable.zip: Beremiz-windows-build
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   168
	rm -f $@
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   169
	cd installer; zip -r -q ../$@ .
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   170
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   171
VERSIONPY=sources/beremiz/version.py
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   172
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   173
Beremiz-nsis-installer.exe: Beremiz-windows-build $(src)/license.txt $(src)/install.nsi 
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   174
	export BVERSION=`python3 $(VERSIONPY)` ;\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   175
	sed -e "s/\$$BVERSION/$$BVERSION/g" $(src)/license.txt > installer/license.txt ;\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   176
	sed -e "s/\$$BVERSION/$$BVERSION/g" $(src)/install.nsi |\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   177
	sed -e "s#\$$MSYS_DIR#$(MSYS_DIR)#g" |\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   178
	sed -e "s#\$$MSYS_ENV_DIR#$(MSYS_ENV_DIR)#g" > install.nsi
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 116
diff changeset
   179
	makensis install.nsi
37
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   180
fd09116d3537 New windows installer cross build, using patched pacman to get MSYS2's packages and PIP over Wine to get PyPI packages. Work in progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   181