windows_installer.mk
changeset 37 fd09116d3537
child 38 3991f82369cb
equal deleted inserted replaced
36:ad68e85dc416 37:fd09116d3537
       
     1 TIMESTAMP=$(shell date '+%y.%m.%d')
       
     2 
       
     3 CROSS_COMPILE=i686-w64-mingw32
       
     4 CROSS_COMPILE_LIBS_DIR=$(shell dirname $(shell $(CROSS_COMPILE)-gcc -print-libgcc-file-name))
       
     5 CC=$(CROSS_COMPILE)-gcc
       
     6 CXX=$(CROSS_COMPILE)-g++
       
     7 
       
     8 installer:
       
     9 	mkdir -p installer
       
    10 
       
    11 
       
    12 CURDIR:=$(shell pwd)
       
    13 PACMANPFX=$(CURDIR)/pacman
       
    14 msysdir=installer/msys32
       
    15 MSYS_ROOT=$(CURDIR)/$(msysdir)
       
    16 
       
    17 pacman/.stamp: | installer
       
    18 	rm -rf pacman pacman-6.0.0
       
    19 	$(call get_src_http,https://sources.archlinux.org/other/pacman,pacman-6.0.0.tar.xz)\
       
    20 	tar -xJf $$dld
       
    21 	cd pacman-6.0.0 ;\
       
    22 	patch -p1 < $(src)/pacman-6.0.0-nogpg-relative_conf.patch ;\
       
    23 	meson -Droot-dir=$(MSYS_ROOT) -Dsysconfdir=$(MSYS_ROOT)/etc -Dlocalstatedir=$(MSYS_ROOT)/var build ;\
       
    24 	DESTDIR=$(PACMANPFX) ninja -C build install
       
    25 	touch $@
       
    26 
       
    27 define pacman_install
       
    28 LD_LIBRARY_PATH=$(PACMANPFX)/usr/lib/x86_64-linux-gnu/ fakeroot pacman/usr/bin/pacman -S $(1) --arch i686 --noconfirm -cachedir $(distfiles)
       
    29 endef
       
    30 
       
    31 $(msysdir)/.stamp: pacman/.stamp | installer
       
    32 	rm -rf installer/msys32
       
    33 	$(call get_src_http,http://repo.msys2.org/distrib/i686,msys2-base-i686-20210705.tar.xz)\
       
    34 	tar -C installer -xJf $$dld
       
    35 	$(call pacman_install, mingw-w64-i686-gcc)
       
    36 	$(call pacman_install, make)
       
    37 	touch $@
       
    38 
       
    39 
       
    40 msiexec = WINEPREFIX=$(tmp) $(XVFBRUN) msiexec
       
    41 wine = WINEPREFIX=$(tmp) $(XVFBRUN) wine
       
    42 pydir = installer/python
       
    43 pysite = $(pydir)/Lib/site-packages
       
    44 
       
    45 python: $(pydir)/.stamp
       
    46 $(pydir)/.stamp: | installer
       
    47 	rm -rf $(pydir)
       
    48 	mkdir -p $(pydir)
       
    49 	
       
    50 	# Python
       
    51 	$(call get_src_http,http://www.python.org/ftp/python/2.7.13,python-2.7.13.msi)\
       
    52 	$(msiexec) /qn /i $$dld TARGETDIR=.\\$(pydir)
       
    53 	
       
    54 	# # wxPython fails if VC9.0 redistribuable is not fully here.
       
    55 	# $(call get_src_http,http://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140,vcredist_x86.exe)\
       
    56 	# cp $$dld $(tmp)
       
    57 	# $(wine) $(tmp)/vcredist_x86.exe /qn /i
       
    58 	# cp -fu $(tmp)/drive_c/windows/winsxs/x86_microsoft.vc90*/* $(pydir)
       
    59 	
       
    60 	$(wine) $(pydir)/python.exe -m pip install --only-binary :all: --cache-dir $(distfiles) \
       
    61         wxPython            \
       
    62         future              \
       
    63         matplotlib          \
       
    64         pywin32             \
       
    65         twisted             \
       
    66         pyOpenSSL           \
       
    67         Nevow               \
       
    68         autobahn            \
       
    69         msgpack_python      \
       
    70         u-msgpack-python    \
       
    71         zeroconf=0.20.0     \
       
    72         lxml                \
       
    73         sslpsk              \
       
    74         pycountry           \
       
    75         fonttools           \
       
    76         Brotli
       
    77 	
       
    78 	$(wine) $(pydir)/python.exe -m pip install --cache-dir $(distfiles) \
       
    79         Pyro                \
       
    80         gnosis              
       
    81 	
       
    82 	# # service identity (twisted prereq) ?
       
    83 	# # python sslpsk (to have PYROPSK)
       
    84 	# # FIXME : this uses 'some' binaries of openssl that forces us to stick to python 2.7.13
       
    85 	# # FIXME : (from here : https://www.npcglib.org/~stathis/blog/precompiled-openssl/)
       
    86 	# # FIXME : build it, and use openssl binaries from https://github.com/python/cpython-bin-deps/tree/openssl-bin-1.0.2k
       
    87 	# WxGlade
       
    88 	$(call get_src_http,https://github.com/wxGlade/wxGlade/archive,v0.8.3.zip)\
       
    89 	unzip -d $(tmp) $$dld
       
    90 	mv $(tmp)/wxGlade-0.8.3 $(pysite)/wxglade
       
    91 	
       
    92 	touch $@
       
    93 
       
    94 matiecdir = installer/matiec
       
    95 matiec: $(matiecdir)/.stamp
       
    96 $(matiecdir)/.stamp: sources/matiec_src | installer
       
    97 	cp -a sources/matiec $(tmp);\
       
    98 	cd $(tmp)/matiec;\
       
    99 	autoreconf;\
       
   100 	automake --add-missing;\
       
   101 	./configure --host=$(CROSS_COMPILE);\
       
   102 	make -j$(CPUS);
       
   103 	rm -rf $(matiecdir)
       
   104 	mkdir -p $(matiecdir)
       
   105 	mv $(tmp)/matiec/*.exe $(matiecdir)
       
   106 	
       
   107 	# install necessary shared libraries from local cross-compiler
       
   108 	cp $(CROSS_COMPILE_LIBS_DIR)/libgcc_s_sjlj-1.dll $(matiecdir)
       
   109 	cp $(CROSS_COMPILE_LIBS_DIR)/libstdc++-6.dll $(matiecdir)
       
   110 	
       
   111 	mv $(tmp)/matiec/lib $(matiecdir)
       
   112 	touch $@
       
   113 
       
   114 beremizdir = installer/beremiz
       
   115 
       
   116 beremiz: $(beremizdir)/.stamp
       
   117 $(beremizdir)/.stamp:  sources/beremiz_src | installer
       
   118 	rm -rf $(beremizdir);\
       
   119 	cp -a sources/beremiz $(beremizdir);\
       
   120 	touch $@
       
   121 
       
   122 ide_revisions = installer/revisions.txt
       
   123 $(ide_revisions): revisions.txt
       
   124 	cp $< $@ 
       
   125 
       
   126 Beremiz-build: Beremiz-$(TIMESTAMP)_build
       
   127 Beremiz-$(TIMESTAMP)_build: $(msysdir)/.stamp $(pydir)/.stamp $(matiecdir)/.stamp $(beremizdir)/.stamp ide_targets_from_dist $(ide_revisions)
       
   128 	touch $@
       
   129 
       
   130 Beremiz-archive: Beremiz-$(TIMESTAMP).zip
       
   131 
       
   132 Beremiz-installer: Beremiz-$(TIMESTAMP).exe
       
   133 
       
   134 Beremiz-$(TIMESTAMP).zip: Beremiz-$(TIMESTAMP)_build
       
   135 	rm -f $@
       
   136 	cd installer; zip -r -q ../$@ .
       
   137 
       
   138 Beremiz-$(TIMESTAMP).exe: Beremiz-$(TIMESTAMP)_build $(src)/license.txt $(src)/install.nsi 
       
   139 	sed -e 's/\$$BVERSION/$(TIMESTAMP)/g' $(src)/license.txt > installer/license.txt
       
   140 	sed -e 's/\$$BVERSION/$(TIMESTAMP)/g' $(src)/install.nsi |\
       
   141 	makensis -
       
   142 
       
   143 
       
   144