Makefile
author Edouard Tisserant <edouard.tisserant@gmail.com>
Mon, 09 Oct 2023 16:41:10 +0200
changeset 124 9304b56075c2
parent 123 032aaa29f498
permissions -rw-r--r--
Snapcraft: Rename SNAPCRAFT_* to new CRAFT_*
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
     1
#! gmake
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
     2
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: 36
diff changeset
     3
# This is top level Makefile for beremiz_public_dist
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
     4
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: 36
diff changeset
     5
# see also: 
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: 36
diff changeset
     6
#   build_in_docker.sh : use case example
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: 36
diff changeset
     7
#   provision_bionic64.sh : prerequisites
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: 36
diff changeset
     8
79
a8b434605895 Add Snap Package.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 62
diff changeset
     9
all: main_target
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: 36
diff changeset
    10
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: 36
diff changeset
    11
DIST ?= win32
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    12
29
503b0ef635cc Upgrade Makefile
Edouard Tisserant
parents: 28
diff changeset
    13
src := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    14
WORKSPACE ?= $(abspath $(src)/..)
29
503b0ef635cc Upgrade Makefile
Edouard Tisserant
parents: 28
diff changeset
    15
CPUS := `cat /proc/cpuinfo | grep -e 'processor\W*:\W*[[:digit:]]*' | nl -n ln | tail -n1 | cut -f1`
101
5799370243c0 Version "name" of installer and snap is now deduced from beremiz' version.py
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 87
diff changeset
    16
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    17
distfiles = $(src)/distfiles
6
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    18
sfmirror = downloads
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: 36
diff changeset
    19
tmp := $(shell rm -rf $${TMPDIR:-/tmp}/beremiz_dist_build_tmp.* ; mktemp -d -t beremiz_dist_build_tmp.XXXXXXXXXX)
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    20
6
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    21
define hg_get_archive
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    22
	hg -R $(WORKSPACE)/`basename $(1)` archive $(2) $(1);\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    23
	hg -R $(WORKSPACE)/`basename $(1)` id -i | sed 's/\+//' > $(1)/revision;
15
db66054a2ff3 create and add file with revision information for Beremiz
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 14
diff changeset
    24
endef
db66054a2ff3 create and add file with revision information for Beremiz
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 14
diff changeset
    25
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    26
define get_src_hg
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: 36
diff changeset
    27
	rm -rf $(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: 36
diff changeset
    28
	$(call hg_get_archive, $(1), $(2))
6
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    29
endef
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    30
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    31
define get_src_git
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    32
endef
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    33
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    34
define get_src_http
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: 36
diff changeset
    35
	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`) ) ) &&
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    36
endef
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    37
6
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    38
ifneq ("$(DIST)","")
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    39
include $(src)/$(DIST).mk
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    40
endif
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    41
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    42
FROM_SOURCE_PROJECTS=beremiz matiec $(DIST_FROM_SOURCE_PROJECTS)
6
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    43
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: 36
diff changeset
    44
define get_revision
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: 36
diff changeset
    45
$(1)_revision?=$(lastword $(shell grep $(1) $(src)/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: 36
diff changeset
    46
endef
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    47
$(foreach project,$(FROM_SOURCE_PROJECTS),$(eval $(call get_revision,$(project))))
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    48
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    49
tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp --exclude=__pycache__
8
b7e0285edfa8 Added msys' make, bash and coreutils with mingw binaries
Edouard Tisserant
parents: 6
diff changeset
    50
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: 36
diff changeset
    51
define get_revisionid
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    52
$(1)_revisionid ?=\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    53
	$(if $(filter local, $($(1)_revision)),\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    54
		$(shell tar $(tar_opts) -P -c $(WORKSPACE)/$(1) | sha1sum | cut -d ' ' -f 1),\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    55
		$(1)_revisionid?=$$(shell hg -R $(WORKSPACE)/$(1) id -i -r $($(1)_revision)))
8
b7e0285edfa8 Added msys' make, bash and coreutils with mingw binaries
Edouard Tisserant
parents: 6
diff changeset
    56
endef
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    57
$(foreach project,$(FROM_SOURCE_PROJECTS),$(eval $(call get_revisionid,$(project))))
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: 36
diff changeset
    58
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: 36
diff changeset
    59
sources:
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: 36
diff changeset
    60
	mkdir -p sources
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: 36
diff changeset
    61
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: 36
diff changeset
    62
define make_src_rule
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: 36
diff changeset
    63
sources/$(1)_src: sources/$(1)_$($(1)_revisionid)
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: 36
diff changeset
    64
	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: 36
diff changeset
    65
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: 36
diff changeset
    66
sources/$(1)_$($(1)_revisionid): | sources
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    67
	rm -rf sources/$(1)*
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    68
ifeq ($($(1)_revision),local)
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    69
	echo "Copy local source code for $(1)_$($(1)_revisionid)"
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    70
	tar -C $(WORKSPACE) $(tar_opts) -P -c $(1) | tar -C sources -x
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    71
else
57
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 45
diff changeset
    72
	echo "Checkout HG source $(1)_$($(1)_revisionid)"
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: 36
diff changeset
    73
	$(call get_src_hg,sources/$(1),-r $($(1)_revisionid))
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    74
endif
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: 36
diff changeset
    75
	touch $$@
8
b7e0285edfa8 Added msys' make, bash and coreutils with mingw binaries
Edouard Tisserant
parents: 6
diff changeset
    76
endef
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    77
$(foreach project,$(FROM_SOURCE_PROJECTS),$(eval $(call make_src_rule,$(project))))
22
07ad3ba42d39 Experimental docker based installer build, + update of mingw binaries - builds, untested
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 21
diff changeset
    78
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    79
own_sources: $(foreach project,$(FROM_SOURCE_PROJECTS), sources/$(project)_src)
8
b7e0285edfa8 Added msys' make, bash and coreutils with mingw binaries
Edouard Tisserant
parents: 6
diff changeset
    80
	touch $@
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    81
81
a95b2fa896e9 SNAP: add SVGHMI and OPC-UA dependencies
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 79
diff changeset
    82
all_sources: own_sources sources/open62541_src
a95b2fa896e9 SNAP: add SVGHMI and OPC-UA dependencies
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 79
diff changeset
    83
	touch $@
a95b2fa896e9 SNAP: add SVGHMI and OPC-UA dependencies
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 79
diff changeset
    84
87
3682a91e7bb2 Fix generation of revisions.txt in makefile
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 82
diff changeset
    85
sources/open62541_src: | sources
81
a95b2fa896e9 SNAP: add SVGHMI and OPC-UA dependencies
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 79
diff changeset
    86
	rm -rf sources/open62541
123
032aaa29f498 Add Python3 in Snap build + doc fixes
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 120
diff changeset
    87
	$(call get_src_http,https://github.com/open62541/open62541/archive/refs/tags,v1.3.7.tar.gz)\
81
a95b2fa896e9 SNAP: add SVGHMI and OPC-UA dependencies
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 79
diff changeset
    88
	tar -xzf $$dld
123
032aaa29f498 Add Python3 in Snap build + doc fixes
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 120
diff changeset
    89
	mv open62541-1.3.7 sources/open62541
81
a95b2fa896e9 SNAP: add SVGHMI and OPC-UA dependencies
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 79
diff changeset
    90
	
a95b2fa896e9 SNAP: add SVGHMI and OPC-UA dependencies
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 79
diff changeset
    91
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: 36
diff changeset
    92
define show_revision_details
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    93
	$(if $(filter local, $($(1)_revision)),\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    94
		echo -n $(1) "state is: "; test -d .hg \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    95
			&& (hg -R $(WORKSPACE)/$(1) id; echo; hg -R $(WORKSPACE)/$(1) st) \
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    96
			|| (git -C $(WORKSPACE)/$(1) show --pretty=format:'%P' -s; echo; git -C $(WORKSPACE)/$(1) status --porcelain);,\
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
    97
		echo -n $(1) "revision is: "; hg -R $(WORKSPACE)/$(1) id -r $($(1)_revisionid); )
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: 36
diff changeset
    98
endef
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    99
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: 36
diff changeset
   100
revisions.txt: $(src)/revisions.txt own_sources
57
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 45
diff changeset
   101
	echo "Generate revisions.txt"
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: 36
diff changeset
   102
	echo "\n******* PACKAGE REVISIONS ********\n" > revisions.txt
120
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
   103
	(echo -n "beremiz_public_dist revision is: "; test -d .hg && (hg -R $(src) id ; echo; hg -R $(src) st) || (git -C $(src) show --pretty=format:'%P' -s; echo; git -C $(src) status --porcelain)) >> revisions.txt
02e37d9e96a9 Windows Installer : Python3 + 64bit
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 112
diff changeset
   104
	($(foreach project,$(FROM_SOURCE_PROJECTS),$(call show_revision_details,$(project)))) >> revisions.txt
6
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
   105
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
   106
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: 36
diff changeset
   107