Edouard@0: #! gmake Edouard@0: Edouard@0: # This is Makefile for Beremiz installer Edouard@0: # invoke with "make" on a linux box having those packages installed : Edouard@0: # - wine Edouard@0: # - mingw32 Edouard@0: # - tar Edouard@0: # - unrar Edouard@0: # - wget Edouard@0: # - nsis Edouard@0: Edouard@0: version = 1.03 Edouard@0: Edouard@0: HGROOT := ~/src Edouard@0: CPUS = 8 Edouard@0: Edouard@0: src := $(shell dirname $(lastword $(MAKEFILE_LIST))) Edouard@0: distfiles = $(src)/distfiles Edouard@0: sfmirror = ovh Edouard@0: tmp := $(shell mktemp -d) Edouard@0: Edouard@0: define get_src_hg Edouard@0: hg -R $(HGROOT)/`basename $(1)` archive $(tmp)/`basename $(1)`.tar.bz2 Edouard@0: mkdir $(1) Edouard@0: tar --strip-components=1 -C $(1) -xvjf $(tmp)/`basename $(1)`.tar.bz2 Edouard@0: endef Edouard@0: Edouard@0: define get_src_http Edouard@1: dld=$(distfiles)/$(2);( ( [ -f $$dld ] || wget $(1)/$(2) -O $$dld ) && ( [ ! -f $$dld.md5 ] && md5sum $$dld > $$dld.md5 || md5sum -c $$dld.md5 ) ) && Edouard@0: endef Edouard@0: Edouard@0: define get_src_pypi Edouard@0: $(call get_src_http,http://pypi.python.org/packages/$(1),$(2)) Edouard@0: endef Edouard@0: Edouard@0: define get_src_sf Edouard@0: $(call get_src_http,http://$(sfmirror).dl.sourceforge.net/project/$(1),$(2)) Edouard@0: endef Edouard@0: Edouard@0: all: Beremiz-$(version).exe Edouard@0: Edouard@0: mingwdir=build/mingw Edouard@0: mingw: Edouard@0: mkdir -p $(mingwdir) Edouard@0: # windows.h Edouard@0: $(call get_src_sf,mingw/MinGW/BaseSystem/RuntimeLibrary/Win32-API/w32api-3.17,w32api-3.17-2-mingw32-dev.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: # mingw runtime Edouard@0: $(call get_src_sf,mingw/MinGW/BaseSystem/RuntimeLibrary/MinGW-RT/mingwrt-3.20,mingwrt-3.20-mingw32-dll.tar.gz)\ Edouard@0: tar -C $(mingwdir) -xvzf $$dld Edouard@0: # mingw headers and lib Edouard@0: $(call get_src_sf,mingw/MinGW/BaseSystem/RuntimeLibrary/MinGW-RT/mingwrt-3.20,mingwrt-3.20-mingw32-dev.tar.gz)\ Edouard@0: tar -C $(mingwdir) -xvzf $$dld Edouard@0: # binutils Edouard@0: $(call get_src_sf,mingw/MinGW/BaseSystem/GNU-Binutils/binutils-2.21.53,binutils-2.21.53-1-mingw32-bin.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: # C compiler Edouard@0: $(call get_src_sf,mingw/MinGW/BaseSystem/GCC/Version4/gcc-4.6.1-2,gcc-core-4.6.1-2-mingw32-bin.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: # C++ compiler Edouard@0: #$(call get_src_sf,mingw/MinGW/BaseSystem/GCC/Version4/gcc-4.6.1-2,gcc-c++-4.6.1-2-mingw32-bin.tar.lzma)\ Edouard@0: #tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: # dependencies Edouard@0: $(call get_src_sf,mingw/MinGW/gmp/gmp-5.0.1-1,libgmp-5.0.1-1-mingw32-dll-10.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: $(call get_src_sf,mingw/MinGW/mpc/mpc-0.8.1-1,libmpc-0.8.1-1-mingw32-dll-2.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: $(call get_src_sf,mingw/MinGW/mpfr/mpfr-2.4.1-1,libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: #$(call get_src_sf,mingw/MinGW/pthreads-w32/pthreads-w32-2.9.0-pre-20110507-2,libpthreadgc-2.9.0-mingw32-pre-20110507-2-dll-2.tar.lzma)\ Edouard@0: #tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: #$(call get_src_sf,mingw/MinGW/pthreads-w32/pthreads-w32-2.9.0-pre-20110507-2,pthreads-w32-2.9.0-mingw32-pre-20110507-2-dev.tar.lzma)\ Edouard@0: #tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: $(call get_src_sf,mingw/MinGW/gettext/gettext-0.17-1,libintl-0.17-1-mingw32-dll-8.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: $(call get_src_sf,mingw/MinGW/gettext/gettext-0.17-1,libgettextpo-0.17-1-mingw32-dll-0.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: $(call get_src_sf,mingw/MinGW/libiconv/libiconv-1.13.1-1,libiconv-1.13.1-1-mingw32-dll-2.tar.lzma)\ Edouard@0: tar -C $(mingwdir) --lzma -xvf $$dld Edouard@0: Edouard@0: touch mingw Edouard@0: Edouard@0: # a directory to collect binaries that must be in the path Edouard@0: bin_collect_dir = $(mingwdir)/bin Edouard@0: $(bin_collect_dir): mingw Edouard@0: Edouard@0: msiexec = WINEPREFIX=$(tmp) msiexec Edouard@0: wine = WINEPREFIX=$(tmp) wine Edouard@0: pydir = build/python Edouard@0: pysite = $(pydir)/Lib/site-packages Edouard@0: Edouard@0: python: $(bin_collect_dir) Edouard@0: # Python Edouard@0: $(call get_src_http,http://www.python.org/ftp/python/2.7.2,python-2.7.2.msi)\ Edouard@0: $(msiexec) /qn /a $$dld TARGETDIR=.\\$(pydir) Edouard@0: cp $(tmp)/drive_c/windows/system32/msvcr71.dll $(bin_collect_dir) Edouard@1: mv $(pydir)/python27.dll $(bin_collect_dir) Edouard@0: Edouard@0: # WxPython (needs running inno unpacker in wine) Edouard@0: $(call get_src_sf,innounp/innounp/innounp%200.36,innounp036.rar)\ Edouard@0: unrar e $$dld innounp.exe $(tmp) Edouard@0: $(call get_src_sf,wxpython/wxPython/2.8.12.1,wxPython2.8-win32-unicode-2.8.12.1-py27.exe)\ Edouard@0: $(wine) $(tmp)/innounp.exe -d$(tmp) -x $$dld Edouard@0: cp -R $(tmp)/\{code_GetPythonDir\}/* $(pydir) Edouard@0: cp -R $(tmp)/\{app\}/* $(pysite) Edouard@1: mv $(pysite)/wx-2.8-msw-unicode/wx/*.dll $(bin_collect_dir) Edouard@0: Edouard@0: # pywin32 Edouard@0: $(call get_src_sf,pywin32/pywin32/Build216,pywin32-216.win32-py2.7.exe)\ Edouard@0: unzip -d $(tmp)/pw32 $$dld ; [ $$? -eq 1 ] #silence error unziping .exe Edouard@0: cp -R $(tmp)/pw32/PLATLIB/* $(pysite) Edouard@1: mv $(pysite)/pywin32_system32/*.dll $(bin_collect_dir) Edouard@0: Edouard@0: # Twisted Edouard@0: $(call get_src_pypi,2.7/T/Twisted,Twisted-11.0.0.winxp32-py2.7.msi)\ Edouard@0: $(msiexec) /qn /a $$dld TARGETDIR=.\\$(pydir) Edouard@0: Edouard@0: # Nevow Edouard@0: $(call get_src_pypi,source/N/Nevow,Nevow-0.10.0.tar.gz)\ Edouard@0: tar -C $(tmp) -xvzf $$dld Edouard@0: for i in nevow formless twisted; do cp -R $(tmp)/Nevow-0.10.0/$$i $(pysite); done Edouard@0: Edouard@0: # Numpy Edouard@0: $(call get_src_pypi,2.7/n/numpy,numpy-1.6.1.win32-py2.7.exe)\ Edouard@0: unzip -d $(tmp)/np $$dld ; [ $$? -eq 1 ] #silence error unziping .exe Edouard@0: cp -R $(tmp)/np/PLATLIB/* $(pysite) Edouard@0: Edouard@0: # SimpleJson Edouard@0: $(call get_src_pypi,source/s/simplejson,simplejson-2.2.1.tar.gz)\ Edouard@0: tar -C $(tmp) -xvzf $$dld Edouard@0: cp -R $(tmp)/simplejson-2.2.1/simplejson/ $(pysite) Edouard@0: Edouard@0: # WxGlade Edouard@0: $(call get_src_http,https://bitbucket.org/agriggio/wxglade/get,b0247325407e.zip)\ Edouard@0: unzip -d $(tmp) $$dld Edouard@0: mv $(tmp)/agriggio-wxglade-b0247325407e $(pysite)/wxglade Edouard@0: Edouard@0: # Pyro Edouard@0: $(call get_src_pypi,source/P/Pyro,Pyro-3.15.tar.gz)\ Edouard@0: tar -C $(tmp) -xvzf $$dld Edouard@0: mv $(tmp)/Pyro-3.15/Pyro $(pysite) Edouard@0: Edouard@0: touch python Edouard@0: Edouard@0: matiecdir = build/matiec Edouard@0: matiec: Edouard@0: $(call get_src_hg,$(tmp)/matiec) Edouard@0: cd $(tmp)/matiec ;\ Edouard@0: ./configure --host=i586-mingw32msvc;\ Edouard@0: make -j$(CPUS); Edouard@0: mkdir $(matiecdir) Edouard@0: mv $(tmp)/matiec/*.exe $(matiecdir) Edouard@0: mv $(tmp)/matiec/lib $(matiecdir) Edouard@0: touch matiec Edouard@0: Edouard@0: plcopeneditor: Edouard@0: $(call get_src_hg,build/plcopeneditor) Edouard@0: touch plcopeneditor Edouard@0: Edouard@0: beremiz: Edouard@0: $(call get_src_hg,build/beremiz) Edouard@0: touch beremiz Edouard@0: Edouard@0: Beremiz-$(version).exe: python mingw matiec plcopeneditor beremiz Edouard@0: sed -e 's/\$$BVERSION/$(version)/g' $(src)/license.txt > build/license.txt Edouard@0: sed -e 's/\$$BVERSION/$(version)/g' $(src)/install.nsi | makensis - Edouard@0: Edouard@0: