Makefile
changeset 37 fd09116d3537
parent 36 ad68e85dc416
child 45 20c1c8a59eab
equal deleted inserted replaced
36:ad68e85dc416 37:fd09116d3537
     1 #! gmake
     1 #! gmake
     2 
     2 
     3 # This is Makefile for Beremiz installer
     3 # This is top level Makefile for beremiz_public_dist
     4 #
       
     5 # Invoke with "make -f path/to/Makefile" on a linux box
       
     6 # in directory where build should happen.
       
     7 #
       
     8 # All those dependencies have to be installed :
       
     9 #
       
    10 #  Windows installer :
       
    11 #  - wine (tested with 1.2 and 1.6. Fail with 1.4)
       
    12 #  - mingw32
       
    13 #  - flex
       
    14 #  - bison
       
    15 #  - tar
       
    16 #  - unrar
       
    17 #  - wget
       
    18 #  - nsis
       
    19 #  - libtool
       
    20 #  - xmlstarlet
       
    21 #  - xsltproc
       
    22 #  - python-lxml
       
    23 #
       
    24 # WARNING : DISPLAY variable have to be defined to a valid X server
       
    25 #           in case it would be a problem, run :
       
    26 #           xvfb-run make -f /path/to/this/Makefile
       
    27 
     4 
    28 version = 1.2-rc1
     5 # see also: 
       
     6 #   build_in_docker.sh : use case example
       
     7 #   provision_bionic64.sh : prerequisites
       
     8 
       
     9 all: Beremiz-installer
       
    10 
       
    11 DIST ?= win32
    29 
    12 
    30 src := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
    13 src := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
    31 HGREMOTE ?= https://hg.beremiz.org/
    14 HGREMOTE ?= REMOTE_HG_DISABLED
    32 HGROOT ?= $(abspath $(src)/..)
    15 HGROOT ?= $(abspath $(src)/..)
    33 GITROOT := $(HGROOT)
    16 GITROOT := $(HGROOT)
    34 DIST =
       
    35 CPUS := `cat /proc/cpuinfo | grep -e 'processor\W*:\W*[[:digit:]]*' | nl -n ln | tail -n1 | cut -f1`
    17 CPUS := `cat /proc/cpuinfo | grep -e 'processor\W*:\W*[[:digit:]]*' | nl -n ln | tail -n1 | cut -f1`
    36 BLKDEV=/dev/null
    18 BLKDEV=/dev/null
    37 
    19 
    38 
    20 XVFBRUN ?= xvfb-run
    39 CROSS_COMPILE=i686-w64-mingw32
       
    40 CROSS_COMPILE_LIBS_DIR=$(shell dirname $(shell $(CROSS_COMPILE)-gcc -print-libgcc-file-name))
       
    41 CC=$(CROSS_COMPILE)-gcc
       
    42 CXX=$(CROSS_COMPILE)-g++
       
    43 
       
    44 define get_runtime_libs
       
    45 	cp $(CROSS_COMPILE_LIBS_DIR)/libgcc_s_sjlj-1.dll $(1)
       
    46 	cp $(CROSS_COMPILE_LIBS_DIR)/libstdc++-6.dll $(1)
       
    47 endef
       
    48 
    21 
    49 distfiles = $(src)/distfiles
    22 distfiles = $(src)/distfiles
    50 sfmirror = downloads
    23 sfmirror = downloads
    51 tmp := $(shell mktemp -d)
    24 tmp := $(shell rm -rf $${TMPDIR:-/tmp}/beremiz_dist_build_tmp.* ; mktemp -d -t beremiz_dist_build_tmp.XXXXXXXXXX)
    52 
    25 
    53 define hg_get_archive
    26 define hg_get_archive
    54 test -d $(HGROOT)/`basename $(1)` || hg --cwd $(HGROOT) clone $(HGREMOTE)`basename $(1)`
    27 	test -d $(HGROOT)/`basename $(1)` || hg --cwd $(HGROOT) clone $(HGREMOTE)`basename $(1)`;\
    55 hg -R $(HGROOT)/`basename $(1)` archive $(2) $(1)
    28 	hg -R $(HGROOT)/`basename $(1)` archive $(2) $(1);\
    56 hg -R $(HGROOT)/`basename $(1)` id -i | sed 's/\+//' > $(1)/revision
    29 	hg -R $(HGROOT)/`basename $(1)` id -i | sed 's/\+//' > $(1)/revision;
    57 endef
    30 endef
    58 
    31 
    59 define get_src_hg
    32 define get_src_hg
    60 rm -rf $(1)
    33 	rm -rf $(1);\
    61 $(call hg_get_archive, $(1), $(2))
    34 	$(call hg_get_archive, $(1), $(2))
    62 endef
    35 endef
    63 
    36 
    64 define get_src_git
    37 define get_src_git
    65 rm -rf $(1)
    38 	rm -rf $(1)
    66 mkdir $(1)
    39 	test -d $(GITROOT)/`basename $(1)` || git clone $(3) $(GITROOT)/`basename $(1)`
    67 (cd $(GITROOT)/`basename $(1)`; git archive --format=tar $(2)) | tar -C $(1) -x
    40 	mkdir $(1)
       
    41 	(cd $(GITROOT)/`basename $(1)`; git archive --format=tar $(2)) | tar -C $(1) -x
    68 endef
    42 endef
    69 
    43 
    70 define get_src_http
    44 define get_src_http
    71 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`) ) ) &&
    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`) ) ) &&
    72 endef
    46 endef
    73 
    47 
    74 define get_src_pypi
    48 get_src_pypi=$(call get_src_http,https://pypi.python.org/packages/$(1),$(2))
    75 $(call get_src_http,https://pypi.python.org/packages/$(1),$(2))
       
    76 endef
       
    77 
    49 
    78 define get_src_sf
    50 get_src_sf=$(call get_src_http,https://$(sfmirror).sourceforge.net/project/$(1),$(2))
    79 $(call get_src_http,https://$(sfmirror).sourceforge.net/project/$(1),$(2))
       
    80 endef
       
    81 
    51 
    82 all: Beremiz-$(version).exe $(targets_add)
    52 include $(src)/windows_installer.mk
    83 
       
    84 
    53 
    85 ifneq ("$(DIST)","")
    54 ifneq ("$(DIST)","")
    86 include $(src)/$(DIST).mk
    55 include $(src)/$(DIST).mk
    87 endif
    56 endif
    88 
    57 
    89 build:
    58 OWN_PROJECTS=beremiz matiec $(OWN_PROJECTS_EX)
    90 	rm -rf build
       
    91 	mkdir -p build
       
    92 
    59 
    93 # native toolchain, pre-built
    60 define get_revision
    94 mingwdir=build/mingw
    61 $(1)_revision?=$(lastword $(shell grep $(1) $(src)/revisions.txt))
       
    62 endef
       
    63 $(foreach project,$(OWN_PROJECTS),$(eval $(call get_revision,$(project))))
    95 
    64 
    96 define get_mingw
    65 define get_revisionid
    97 $(call get_src_sf,mingw/MinGW/Base/$(1),$(2)) tar -C $(mingwdir) -xf $$dld
    66 $(1)_revisionid=$(shell hg -R $(HGROOT)/$(1) id -i -r $($(1)_revision))
    98 endef
    67 endef
    99 define get_msys
    68 $(foreach project,$(OWN_PROJECTS),$(eval $(call get_revisionid,$(project))))
   100 $(call get_src_sf,mingw/MSYS/Base/$(1),$(2)) tar -C $(mingwdir) -xf $$dld
    69 
       
    70 sources:
       
    71 	mkdir -p sources
       
    72 
       
    73 define make_src_rule
       
    74 sources/$(1)_src: sources/$(1)_$($(1)_revisionid)
       
    75 	touch $$@
       
    76 
       
    77 sources/$(1)_$($(1)_revisionid): | sources
       
    78 	rm -rf sources/$(1)*
       
    79 	$(call get_src_hg,sources/$(1),-r $($(1)_revisionid))
       
    80 	touch $$@
   101 endef
    81 endef
   102 mingw: |build
    82 $(foreach project,$(OWN_PROJECTS),$(eval $(call make_src_rule,$(project))))
   103 	rm -rf $(mingwdir)
       
   104 	mkdir -p $(mingwdir)
       
   105 	# windows.h
       
   106 	$(call get_mingw,w32api/w32api-5.0.1,w32api-5.0.1-mingw32-dev.tar.xz)
       
   107 	# mingw runtime
       
   108 	$(call get_mingw,mingwrt/mingwrt-5.0.1,mingwrt-5.0.1-mingw32-dll.tar.xz)
       
   109 	$(call get_mingw,mingwrt/mingwrt-5.0.1,libmingwex-5.0.1-mingw32-dll-0.tar.xz)
       
   110 	$(call get_mingw,isl/isl-0.18,libisl-0.18-1-mingw32-dll-15.tar.xz)
       
   111 	# mingw headers and lib
       
   112 	$(call get_mingw,mingwrt/mingwrt-5.0.1,mingwrt-5.0.1-mingw32-dev.tar.xz)
       
   113 	# binutils
       
   114 	$(call get_mingw,binutils/binutils-2.28,binutils-2.28-1-mingw32-bin.tar.xz)
       
   115 	# C compiler
       
   116 	$(call get_mingw,gcc/Version6/gcc-6.3.0,gcc-core-6.3.0-1-mingw32-bin.tar.xz)
       
   117 	$(call get_mingw,gcc/Version6/gcc-6.3.0,libgcc-6.3.0-1-mingw32-dll-1.tar.xz)
       
   118 	# dependencies
       
   119 	$(call get_mingw,gmp/gmp-6.1.2,libgmp-6.1.2-2-mingw32-dll-10.tar.xz)
       
   120 	$(call get_mingw,mpc/mpc-1.0.3,libmpc-1.0.3-1-mingw32-dll-3.tar.xz)
       
   121 	$(call get_mingw,mpfr/mpfr-3.1.5,libmpfr-3.1.5-1-mingw32-dll-4.tar.xz)
       
   122 	$(call get_mingw,gettext/gettext-0.18.3.2-2,libintl-0.18.3.2-2-mingw32-dll-8.tar.xz)
       
   123 	$(call get_mingw,gettext/gettext-0.18.3.2-2,libgettextpo-0.18.3.2-2-mingw32-dll-0.tar.xz)
       
   124 	$(call get_mingw,libiconv/libiconv-1.14-3,libiconv-1.14-3-mingw32-dll.tar.lzma)
       
   125 
    83 
   126 	# make, bash, and dependencies
    84 own_sources: $(foreach project,$(OWN_PROJECTS), sources/$(project)_src)
   127 	$(call get_msys,bash/bash-3.1.23-1,bash-3.1.23-1-msys-1.0.18-bin.tar.xz)
       
   128 	$(call get_msys,coreutils/coreutils-5.97-3,coreutils-5.97-3-msys-1.0.13-bin.tar.lzma)
       
   129 	$(call get_msys,libiconv/libiconv-1.14-1,libiconv-1.14-1-msys-1.0.17-bin.tar.lzma)
       
   130 	$(call get_msys,libiconv/libiconv-1.14-1,libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma)
       
   131 	$(call get_msys,gettext/gettext-0.18.1.1-1,libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma)
       
   132 	$(call get_msys,regex/regex-1.20090805-2,libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma)
       
   133 	$(call get_msys,termcap/termcap-0.20050421_1-2,libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma)
       
   134 	$(call get_msys,make/make-3.81-3,make-3.81-3-msys-1.0.13-bin.tar.lzma) 
       
   135 	$(call get_msys,msys-core/msys-1.0.19-1,msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz)
       
   136 	$(call get_msys,termcap/termcap-0.20050421_1-2,libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma)
       
   137 	touch $@
    85 	touch $@
   138 
    86 
   139 msiexec = WINEPREFIX=$(tmp) msiexec
    87 define show_revision_details
   140 wine = WINEPREFIX=$(tmp) wine
    88 echo -n $(1) "revision is: "; hg -R $(HGROOT)/$(1) id -r $($(1)_revisionid);
   141 pydir = build/python
    89 endef
   142 pysite = $(pydir)/Lib/site-packages
       
   143 
    90 
   144 python: |build
    91 revisions.txt: $(src)/revisions.txt own_sources
   145 	rm -rf $(pydir)
    92 	echo "\n******* PACKAGE REVISIONS ********\n" > revisions.txt
   146 	mkdir -p $(pydir)
    93 	(echo -n "beremiz_dist revision is: "; hg -R $(src) id;) >> revisions.txt
   147 	
    94 	($(foreach project,$(OWN_PROJECTS),$(call show_revision_details,$(project)))) >> revisions.txt
   148 	# Python
    95 	bash -c 'hg -R $(src) st | ( if read ; then echo -e "\n******* MODIFIED LPCDISTRO ********\n" ; hg -R $(src) st ; fi ) >> revisions.txt'
   149 	$(call get_src_http,http://www.python.org/ftp/python/2.7.3,python-2.7.3.msi)\
       
   150 	$(msiexec) /qn /a $$dld TARGETDIR=.\\$(pydir)
       
   151 	
       
   152 	# WxPython 2.8 (needs running inno unpacker in wine)
       
   153 	$(call get_src_sf,innounp/innounp/innounp%200.36,innounp036.rar)\
       
   154 	unrar e $$dld innounp.exe $(tmp)
       
   155 	$(call get_src_sf,wxpython/wxPython/2.8.12.1,wxPython2.8-win32-unicode-2.8.12.1-py27.exe)\
       
   156 	$(wine) $(tmp)/innounp.exe -d$(tmp)/wx28 -x $$dld
       
   157 	cp -R $(tmp)/wx28/\{code_GetPythonDir\}/* $(pydir)
       
   158 	cp -R $(tmp)/wx28/\{app\}/* $(pysite)
       
   159 	
       
   160 	# WxPython 3.0 (needs running inno unpacker in wine)
       
   161 	$(call get_src_sf,wxpython/wxPython/3.0.2.0,wxPython3.0-win32-3.0.2.0-py27.exe)\
       
   162 	$(wine) $(tmp)/innounp.exe -d$(tmp)/wx30 -x $$dld
       
   163 	cp -R $(tmp)/wx30/\{code_GetPythonDir\}/* $(pydir)
       
   164 	cp -R $(tmp)/wx30/\{app\}/* $(pysite)
       
   165 	
       
   166 	# wxPython fails if VC9.0 bullshit is not fully here.
       
   167 	$(call get_src_http,http://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140,vcredist_x86.exe)\
       
   168 	cp $$dld $(tmp)
       
   169 	$(wine) $(tmp)/vcredist_x86.exe /qn /a
       
   170 	cp $(tmp)/drive_c/windows/winsxs/x86_Microsoft.VC90.CRT*/* $(pydir)
       
   171 	
       
   172 	# MathPlotLib
       
   173 	$(call get_src_http,https://github.com/downloads/matplotlib/matplotlib,matplotlib-1.2.0.win32-py2.7.exe)\
       
   174 	unzip -d $(tmp)/mathplotlib $$dld ; [ $$? -eq 1 ] #silence error unziping .exe
       
   175 	cp -R $(tmp)/mathplotlib/PLATLIB/* $(pysite)
       
   176 	
       
   177 	# pywin32
       
   178 	$(call get_src_sf,pywin32/pywin32/Build216,pywin32-216.win32-py2.7.exe)\
       
   179 	unzip -d $(tmp)/pw32 $$dld ; [ $$? -eq 1 ] #silence error unziping .exe
       
   180 	cp -R $(tmp)/pw32/PLATLIB/* $(pysite)
       
   181 	
       
   182 	# zope.interface (twisted prereq)
       
   183 	$(call get_src_pypi,9d/2d/beb32519c0bd19bda4ac38c34db417d563ee698518e582f951d0b9e5898b,zope.interface-4.3.2-py2.7-win32.egg)\
       
   184 	unzip -d $(tmp) $$dld
       
   185 	cp -R $(tmp)/zope $(pysite)
       
   186 	
       
   187 	# six (pyopenssl prereq)
       
   188 	$(call get_src_pypi,67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a,six-1.11.0-py2.py3-none-any.whl)\
       
   189 	unzip -d $(tmp) $$dld 
       
   190 	cp -R $(tmp)/six.py $(pysite)
       
   191 	
       
   192 	# enum34 (cryptography prereq)
       
   193 	$(call get_src_pypi,bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876,enum34-1.1.6.tar.gz)\
       
   194 	tar -C $(tmp) -xzf $$dld
       
   195 	cp -R $(tmp)/enum34-1.1.6/enum $(pysite)
       
   196 	
       
   197 	# cryptography (pyopenssl prereq)
       
   198 	$(call get_src_pypi,17/08/04dc376411968ac21f2e11a8d7d70e936a654172567672fa79710a137bd9,cryptography-2.1.4-cp27-cp27m-win32.whl)\
       
   199 	unzip -d $(tmp) $$dld 
       
   200 	cp -R $(tmp)/cryptography $(pysite)
       
   201 	
       
   202 	# pyopenssl (twisted/ssl prereq)
       
   203 	$(call get_src_pypi,79/db/7c0cfe4aa8341a5fab4638952520d8db6ab85ff84505e12c00ea311c3516,pyOpenSSL-17.5.0-py2.py3-none-any.whl)\
       
   204 	unzip -d $(tmp) $$dld 
       
   205 	cp -R $(tmp)/OpenSSL $(pysite)
       
   206 	
       
   207 	# pyasn1 (service identity prereq)
       
   208 	$(call get_src_pypi,eb/3d/b7d0fdf4a882e26674c68c20f40682491377c4db1439870f5b6f862f76ed,pyasn1-0.4.2.tar.gz)\
       
   209 	tar -C $(tmp) -xzf $$dld
       
   210 	cp -R $(tmp)/pyasn1-0.4.2/pyasn1 $(pysite)
       
   211 	
       
   212 	# pyasn1-modules (service identity prereq)
       
   213 	$(call get_src_pypi,ab/76/36ab0e099e6bd27ed95b70c2c86c326d3affa59b9b535c63a2f892ac9f45,pyasn1-modules-0.2.1.tar.gz)\
       
   214 	tar -C $(tmp) -xzf $$dld
       
   215 	cp -R $(tmp)/pyasn1-modules-0.2.1/pyasn1_modules $(pysite)
       
   216 	
       
   217 	# characteristic (service identity prereq)
       
   218 	$(call get_src_pypi,dc/66/54b7a4758ea44fbc93895c7745060005272560fb2c356f2a6f7448ef9a80,characteristic-14.3.0.tar.gz)\
       
   219 	tar -C $(tmp) -xzf $$dld
       
   220 	cp -R $(tmp)/characteristic-14.3.0/characteristic.py $(pysite)
       
   221 	
       
   222 	# service identity (twisted prereq)
       
   223 	$(call get_src_pypi,de/2a/cab6e30be82c8fcd2339ef618036720eda954cf05daef514e386661c9221,service_identity-17.0.0.tar.gz)\
       
   224 	tar -C $(tmp) -xzf $$dld
       
   225 	cp -R $(tmp)/service_identity-17.0.0/src/service_identity $(pysite)
       
   226 	
       
   227 	# txaio (autobahn prereq)
       
   228 	$(call get_src_pypi,d6/95/d0c67304515f352342bc8fd14e5a3e7ca924134608acb730916073b18464,txaio-2.8.2.tar.gz)\
       
   229 	tar -C $(tmp) -xzf $$dld
       
   230 	cp -R $(tmp)/txaio-2.8.2/txaio $(pysite)
       
   231 	
       
   232 	# python-msgpack (autobahn prereq)
       
   233 	$(call get_src_pypi,59/ca/b8048e184a2edb5b3cd46f38be130e87cbce77f4168ed62344bc33df3e1b,msgpack_python-0.4.8-cp27-cp27m-win32.whl)\
       
   234 	unzip -d $(tmp) $$dld 
       
   235 	cp -R $(tmp)/msgpack $(pysite)
       
   236 	
       
   237 	# u-msgpack-python (autobahn prereq)
       
   238 	$(call get_src_pypi,b8/ff/5730f61767d5acecac103343d66ebf631ebd672fa14e50472f05545749c2,u-msgpack-python-2.4.1.tar.gz)\
       
   239 	tar -C $(tmp) -xzf $$dld
       
   240 	cp -R $(tmp)/u-msgpack-python-2.4.1/umsgpack.py $(pysite)
       
   241 	
       
   242 	# cffi (cryptography prereq)
       
   243 	$(call get_src_pypi,5e/67/01ae6ae50d168d3b92f2a80bf62e07537171d0a1938c8bceb7e64d36829f,cffi-1.11.2-cp27-cp27m-win32.whl)\
       
   244 	unzip -d $(tmp) $$dld 
       
   245 	cp -R $(tmp)/cffi $(tmp)/_cffi_backend.pyd $(pysite)
       
   246 	
       
   247 	# Twisted
       
   248 	$(call get_src_pypi,fe/cb/97504d68c2f4300fb121f700cc2fae10e1856ba043e964acfab02e120835,Twisted-17.9.0-cp27-cp27m-win32.whl)\
       
   249 	unzip -d $(tmp) $$dld 
       
   250 	cp -R $(tmp)/twisted $(pysite)
       
   251 	
       
   252 	# Autobahn
       
   253 	$(call get_src_pypi,e4/2e/01a64212b1eb580d601fa20f146c962235e3493795f46e3b254597ec635d,autobahn-17.10.1.tar.gz)\
       
   254 	tar -C $(tmp) -xzf $$dld
       
   255 	cp -R $(tmp)/autobahn-17.10.1/autobahn $(pysite)
       
   256 	
       
   257 	# Nevow
       
   258 	$(call get_src_pypi,source/N/Nevow,Nevow-0.10.0.tar.gz)\
       
   259 	tar -C $(tmp) -xzf $$dld
       
   260 	for i in nevow formless twisted; do cp -R $(tmp)/Nevow-0.10.0/$$i $(pysite); done
       
   261 	
       
   262 	# Numpy
       
   263 	$(call get_src_pypi,fd/32/196073188f5b8b464e0fabb470f971fa5dcd91b55726a43b40b008212358,numpy-1.13.3-2-cp27-none-win32.whl)\
       
   264 	unzip -d $(tmp) $$dld
       
   265 	cp -R $(tmp)/numpy $(pysite)
       
   266 	
       
   267 	# SimpleJson
       
   268 	$(call get_src_pypi,source/s/simplejson,simplejson-2.2.1.tar.gz)\
       
   269 	tar -C $(tmp) -xzf $$dld
       
   270 	cp -R $(tmp)/simplejson-2.2.1/simplejson/ $(pysite)
       
   271 	
       
   272 	# Zeroconf
       
   273 	$(call get_src_pypi,6b/88/48dbe88b10098f98acef33218763c5630b0081c7fd0849ab4793b1e9b6d3,zeroconf-0.19.1-py2.py3-none-any.whl)\
       
   274 	unzip -d $(tmp)/zeroconf $$dld
       
   275 	cp -R $(tmp)/zeroconf/*.py* $(pysite)
       
   276 	
       
   277 	# netifaces
       
   278 	$(call get_src_pypi,05/00/c719457bcb8f14f9a7b9244c3c5e203c40d041a364cf784cf554aaef8129,netifaces-0.10.6-py2.7-win32.egg)\
       
   279 	unzip -d $(tmp)/netifaces $$dld
       
   280 	cp -R $(tmp)/netifaces/*.py* $(pysite)	
       
   281 	
       
   282 	# WxGlade
       
   283 	$(call get_src_http,https://bitbucket.org/wxglade/wxglade/get,034d891cc947.zip)\
       
   284 	unzip -d $(tmp) $$dld
       
   285 	mv $(tmp)/wxglade-wxglade-034d891cc947 $(pysite)/wxglade
       
   286 	
       
   287 	# Pyro
       
   288 	$(call get_src_pypi,61/68/0978adae315261b87acd216517c2c7f00780396e4d1426c5412458c6a28f,Pyro-3.16.tar.gz)\
       
   289 	tar -C $(tmp) -xzf $$dld
       
   290 	mv $(tmp)/Pyro-3.16/Pyro $(pysite)
       
   291 	
       
   292 	# Lxml
       
   293 	$(call get_src_pypi,c7/e6/26a600d9828554ca9de35d3d1daf3779028bea37025f3dd25e9d58d63bac,lxml-4.1.1-cp27-cp27m-win32.whl)\
       
   294 	unzip -d $(tmp) $$dld
       
   295 	cp -R $(tmp)/lxml $(pysite)
       
   296 	
       
   297 	touch $@
       
   298 
       
   299 	
       
   300 OSSLVER=openssl-1.0.1p
       
   301 MINGPFX=i686-w64-mingw32-
       
   302 
       
   303 openssl:
       
   304 	# Build Openssl
       
   305 	$(call get_src_http,https://openssl.org/source,$(OSSLVER).tar.gz)\
       
   306 	tar -C $(tmp) -xzf $$dld
       
   307 	cd $(tmp)/$(OSSLVER); \
       
   308 	CC=$(MINGPFX)gcc ./Configure mingw && \
       
   309 	make all build-shared CROSS_COMPILE=$(MINGPFX) SHARED_LDFLAGS=-static-libgcc
       
   310 	mv $(tmp)/$(OSSLVER) .;
       
   311 	
       
   312 	touch $@
       
   313 	
       
   314 M2CRVER=M2Crypto-0.22.5
       
   315 
       
   316 m2crypto: openssl
       
   317 	# Build M2crypto
       
   318 	$(call get_src_pypi,54/f5/6fa9bca4a18cc36c0c84c73d41d8e521c8cb70f077b11297efcd985242a6,M2Crypto-0.22.5.tar.gz)\
       
   319 	tar -C $(tmp) -xzf $$dld
       
   320 	cd $(tmp)/$(M2CRVER); \
       
   321 	patch -p1 < $(src)/M2Crypto-mingw-cross-compile-fix.patch && \
       
   322 	PYTHONLIB=$(abspath $(pydir))/libs \
       
   323 	PYTHONINC=$(abspath $(pydir))/include/ \
       
   324 	MINGCCPREFIX=$(MINGPFX) \
       
   325 	    python setup.py build build_ext \
       
   326 	        --openssl=$(CURDIR)/$(OSSLVER) -cmingw32
       
   327 	
       
   328 	# Copy openssl dlls directly in M2Crypto package directory
       
   329 	cp -a $(CURDIR)/$(OSSLVER)/*.dll $(tmp)/$(M2CRVER)/build/lib.win32-2.7/M2Crypto 
       
   330 	
       
   331 	# Move result into python site packages
       
   332 	mv $(tmp)/$(M2CRVER)/build/lib.win32-2.7/M2Crypto $(pysite)
       
   333 	
       
   334 	touch $@
       
   335 
       
   336 matiecdir = build/matiec
       
   337 matiec: |build
       
   338 	$(call get_src_hg,$(tmp)/matiec)
       
   339 	cd $(tmp)/matiec ;\
       
   340 	autoreconf;\
       
   341 	automake --add-missing;\
       
   342 	./configure --host=$(CROSS_COMPILE);\
       
   343 	make -j$(CPUS);
       
   344 	rm -rf $(matiecdir)
       
   345 	mkdir -p $(matiecdir)
       
   346 	mv $(tmp)/matiec/*.exe $(matiecdir)
       
   347 	
       
   348 	# install necessary shared libraries from local cross-compiler
       
   349 	$(call get_runtime_libs,$(matiecdir))
       
   350 	
       
   351 	mv $(tmp)/matiec/lib $(matiecdir)
       
   352 	touch $@
       
   353 
       
   354 examples: |build
       
   355 	rm -rf  examples
       
   356 	mkdir -p examples
       
   357 
       
   358 beremiz: | build examples
       
   359 	$(call get_src_hg,build/beremiz)
       
   360 	$(call tweak_beremiz_source)
       
   361 	rm -rf examples/canopen_tests
       
   362 	mkdir -p examples/canopen_tests
       
   363 	mv build/beremiz/tests/canopen_* examples/canopen_tests
       
   364 	rm -rf examples/base_tests
       
   365 	mkdir -p examples/base_tests
       
   366 	mv build/beremiz/tests/* examples/base_tests
       
   367 	touch $@
       
   368 
       
   369 CFbuild = build/CanFestival-3
       
   370 CFconfig = $(CFbuild)/objdictgen/canfestival_config.py
       
   371 canfestival: mingw
       
   372 	rm -rf $(CFbuild)
       
   373 	$(call get_src_hg,$(CFbuild))
       
   374 	cd $(CFbuild); \
       
   375 	./configure --can=tcp_win32 \
       
   376 				--cc=$(CC) \
       
   377 				--cxx=$(CXX) \
       
   378 				--target=win32 \
       
   379 				--wx=0
       
   380 	$(MAKE) -C $(CFbuild)
       
   381 	cd $(CFbuild); find . -name "*.o" -exec rm {} ';' #remove object files only
       
   382 	touch $@
       
   383 
       
   384 targets=python m2crypto mingw matiec beremiz
       
   385 Beremiz-$(version).exe: $(targets) $(src)/license.txt $(src)/install.nsi $(targets_ex)
       
   386 	sed -e 's/\$$BVERSION/$(version)/g' $(src)/license.txt > build/license.txt
       
   387 	sed -e 's/\$$BVERSION/$(version)/g' $(src)/install.nsi |\
       
   388 	sed -e 's/\$$BEXTENSIONS/$(extensions)/g' |\
       
   389         makensis -
       
   390 
       
   391 clean_installer:
       
   392 	rm -rf build Beremiz-$(version).exe $(targets) $(targets_ex)
       
   393 
    96 
   394 
    97 
       
    98