Makefile
author Edouard Tisserant <edouard.tisserant@gmail.com>
Thu, 19 May 2022 18:19:23 +0200
changeset 44 c460ec8c65e9
parent 37 fd09116d3537
child 45 20c1c8a59eab
permissions -rw-r--r--
Don't require TTY for docker.
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
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
     9
all: Beremiz-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: 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))))
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
    14
HGREMOTE ?= REMOTE_HG_DISABLED
28
950f79385de7 HGROOT now default to parent of directory containing makefile. Added more instruction in Dockerfile
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 27
diff changeset
    15
HGROOT ?= $(abspath $(src)/..)
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
    16
GITROOT := $(HGROOT)
29
503b0ef635cc Upgrade Makefile
Edouard Tisserant
parents: 28
diff changeset
    17
CPUS := `cat /proc/cpuinfo | grep -e 'processor\W*:\W*[[:digit:]]*' | nl -n ln | tail -n1 | cut -f1`
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
BLKDEV=/dev/null
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    19
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
    20
XVFBRUN ?= xvfb-run
12
1cea304b3e88 use global CROSS_COMPILE prefix to define compilers for matiec and canfestival
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 11
diff changeset
    21
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    22
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
    23
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
    24
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
    25
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
    26
define hg_get_archive
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
	test -d $(HGROOT)/`basename $(1)` || hg --cwd $(HGROOT) clone $(HGREMOTE)`basename $(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
	hg -R $(HGROOT)/`basename $(1)` archive $(2) $(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
    29
	hg -R $(HGROOT)/`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
    30
endef
db66054a2ff3 create and add file with revision information for Beremiz
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 14
diff changeset
    31
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    32
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
    33
	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
    34
	$(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
    35
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
    36
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    37
define get_src_git
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
    38
	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
    39
	test -d $(GITROOT)/`basename $(1)` || git clone $(3) $(GITROOT)/`basename $(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
    40
	mkdir $(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
    41
	(cd $(GITROOT)/`basename $(1)`; git archive --format=tar $(2)) | tar -C $(1) -x
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    42
endef
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    43
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    44
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
    45
	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
    46
endef
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    47
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
    48
get_src_pypi=$(call get_src_http,https://pypi.python.org/packages/$(1),$(2))
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    49
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
    50
get_src_sf=$(call get_src_http,https://$(sfmirror).sourceforge.net/project/$(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
    51
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
    52
include $(src)/windows_installer.mk
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
    53
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    54
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
    55
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
    56
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
    57
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
OWN_PROJECTS=beremiz matiec $(OWN_PROJECTS_EX)
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
    59
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
    60
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
    61
$(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
    62
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: 36
diff changeset
    63
$(foreach project,$(OWN_PROJECTS),$(eval $(call get_revision,$(project))))
8
b7e0285edfa8 Added msys' make, bash and coreutils with mingw binaries
Edouard Tisserant
parents: 6
diff changeset
    64
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
    65
define get_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
    66
$(1)_revisionid=$(shell hg -R $(HGROOT)/$(1) id -i -r $($(1)_revision))
8
b7e0285edfa8 Added msys' make, bash and coreutils with mingw binaries
Edouard Tisserant
parents: 6
diff changeset
    67
endef
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
    68
$(foreach project,$(OWN_PROJECTS),$(eval $(call get_revisionid,$(project))))
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
    69
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
    70
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
    71
	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
    72
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
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
    74
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
    75
	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
    76
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
    77
sources/$(1)_$($(1)_revisionid): | 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
    78
	rm -rf sources/$(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
    79
	$(call get_src_hg,sources/$(1),-r $($(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
    80
	touch $$@
8
b7e0285edfa8 Added msys' make, bash and coreutils with mingw binaries
Edouard Tisserant
parents: 6
diff changeset
    81
endef
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
    82
$(foreach project,$(OWN_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
    83
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
    84
own_sources: $(foreach project,$(OWN_PROJECTS), sources/$(project)_src)
8
b7e0285edfa8 Added msys' make, bash and coreutils with mingw binaries
Edouard Tisserant
parents: 6
diff changeset
    85
	touch $@
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    86
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
    87
define show_revision_details
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
    88
echo -n $(1) "revision is: "; hg -R $(HGROOT)/$(1) id -r $($(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
    89
endef
0
7bc9d95b92bc initial commit, 1.03 installs on WinXP, python test builds and works
Edouard Tisserant
parents:
diff changeset
    90
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
    91
revisions.txt: $(src)/revisions.txt own_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
    92
	echo "\n******* PACKAGE REVISIONS ********\n" > 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
    93
	(echo -n "beremiz_dist revision is: "; hg -R $(src) id;) >> 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
    94
	($(foreach project,$(OWN_PROJECTS),$(call show_revision_details,$(project)))) >> 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
    95
	bash -c 'hg -R $(src) st | ( if read ; then echo -e "\n******* MODIFIED LPCDISTRO ********\n" ; hg -R $(src) st ; fi ) >> 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
    96
862080d48ef2 Various updates and enhancement in installer build system, including support for specialized distributions, existing in other branches
Edouard Tisserant
parents: 5
diff changeset
    97
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