Makefile
changeset 0 7bc9d95b92bc
child 1 edaf97f39e5d
equal deleted inserted replaced
-1:000000000000 0:7bc9d95b92bc
       
     1 #! gmake
       
     2 
       
     3 # This is Makefile for Beremiz installer
       
     4 # invoke with "make" on a linux box having those packages installed :
       
     5 #  - wine
       
     6 #  - mingw32
       
     7 #  - tar
       
     8 #  - unrar
       
     9 #  - wget
       
    10 #  - nsis
       
    11 
       
    12 version = 1.03
       
    13 
       
    14 HGROOT := ~/src
       
    15 CPUS = 8
       
    16 
       
    17 src := $(shell dirname $(lastword $(MAKEFILE_LIST)))
       
    18 distfiles = $(src)/distfiles
       
    19 sfmirror = ovh
       
    20 tmp := $(shell mktemp -d)
       
    21 
       
    22 define get_src_hg
       
    23 hg -R $(HGROOT)/`basename $(1)` archive $(tmp)/`basename $(1)`.tar.bz2
       
    24 mkdir $(1)
       
    25 tar --strip-components=1 -C $(1) -xvjf $(tmp)/`basename $(1)`.tar.bz2
       
    26 endef
       
    27 
       
    28 define get_src_http
       
    29 dld=$(distfiles)/$(2);[ -f $$dld ] && echo "Exists :" $(2) || wget $(1)/$(2) -O $$dld;
       
    30 endef
       
    31 
       
    32 define get_src_pypi
       
    33 $(call get_src_http,http://pypi.python.org/packages/$(1),$(2))
       
    34 endef
       
    35 
       
    36 define get_src_sf
       
    37 $(call get_src_http,http://$(sfmirror).dl.sourceforge.net/project/$(1),$(2))
       
    38 endef
       
    39 
       
    40 all: Beremiz-$(version).exe
       
    41 
       
    42 mingwdir=build/mingw
       
    43 mingw: 
       
    44 	mkdir -p $(mingwdir)
       
    45 	# windows.h
       
    46 	$(call get_src_sf,mingw/MinGW/BaseSystem/RuntimeLibrary/Win32-API/w32api-3.17,w32api-3.17-2-mingw32-dev.tar.lzma)\
       
    47 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    48 	# mingw runtime
       
    49 	$(call get_src_sf,mingw/MinGW/BaseSystem/RuntimeLibrary/MinGW-RT/mingwrt-3.20,mingwrt-3.20-mingw32-dll.tar.gz)\
       
    50 	tar -C $(mingwdir) -xvzf $$dld
       
    51 	# mingw headers and lib
       
    52 	$(call get_src_sf,mingw/MinGW/BaseSystem/RuntimeLibrary/MinGW-RT/mingwrt-3.20,mingwrt-3.20-mingw32-dev.tar.gz)\
       
    53 	tar -C $(mingwdir) -xvzf $$dld
       
    54 	# binutils
       
    55 	$(call get_src_sf,mingw/MinGW/BaseSystem/GNU-Binutils/binutils-2.21.53,binutils-2.21.53-1-mingw32-bin.tar.lzma)\
       
    56 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    57 	# C compiler
       
    58 	$(call get_src_sf,mingw/MinGW/BaseSystem/GCC/Version4/gcc-4.6.1-2,gcc-core-4.6.1-2-mingw32-bin.tar.lzma)\
       
    59 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    60 	# C++ compiler
       
    61 	#$(call get_src_sf,mingw/MinGW/BaseSystem/GCC/Version4/gcc-4.6.1-2,gcc-c++-4.6.1-2-mingw32-bin.tar.lzma)\
       
    62 	#tar -C $(mingwdir) --lzma -xvf $$dld
       
    63 	# dependencies
       
    64 	$(call get_src_sf,mingw/MinGW/gmp/gmp-5.0.1-1,libgmp-5.0.1-1-mingw32-dll-10.tar.lzma)\
       
    65 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    66 	$(call get_src_sf,mingw/MinGW/mpc/mpc-0.8.1-1,libmpc-0.8.1-1-mingw32-dll-2.tar.lzma)\
       
    67 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    68 	$(call get_src_sf,mingw/MinGW/mpfr/mpfr-2.4.1-1,libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma)\
       
    69 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    70 	#$(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)\
       
    71 	#tar -C $(mingwdir) --lzma -xvf $$dld
       
    72 	#$(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)\
       
    73 	#tar -C $(mingwdir) --lzma -xvf $$dld
       
    74 	$(call get_src_sf,mingw/MinGW/gettext/gettext-0.17-1,libintl-0.17-1-mingw32-dll-8.tar.lzma)\
       
    75 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    76 	$(call get_src_sf,mingw/MinGW/gettext/gettext-0.17-1,libgettextpo-0.17-1-mingw32-dll-0.tar.lzma)\
       
    77 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    78 	$(call get_src_sf,mingw/MinGW/libiconv/libiconv-1.13.1-1,libiconv-1.13.1-1-mingw32-dll-2.tar.lzma)\
       
    79 	tar -C $(mingwdir) --lzma -xvf $$dld
       
    80 	
       
    81 	touch mingw
       
    82 
       
    83 # a directory to collect binaries that must be in the path
       
    84 bin_collect_dir = $(mingwdir)/bin
       
    85 $(bin_collect_dir): mingw
       
    86 
       
    87 msiexec = WINEPREFIX=$(tmp) msiexec
       
    88 wine = WINEPREFIX=$(tmp) wine
       
    89 pydir = build/python
       
    90 pysite = $(pydir)/Lib/site-packages
       
    91 
       
    92 python: $(bin_collect_dir)
       
    93 	# Python
       
    94 	$(call get_src_http,http://www.python.org/ftp/python/2.7.2,python-2.7.2.msi)\
       
    95 	$(msiexec) /qn /a $$dld TARGETDIR=.\\$(pydir)
       
    96 	cp $(tmp)/drive_c/windows/system32/msvcr71.dll $(bin_collect_dir)
       
    97 	cp $(pydir)/python27.dll $(bin_collect_dir)
       
    98 	
       
    99 	# WxPython (needs running inno unpacker in wine)
       
   100 	$(call get_src_sf,innounp/innounp/innounp%200.36,innounp036.rar)\
       
   101 	unrar e $$dld innounp.exe $(tmp)
       
   102 	$(call get_src_sf,wxpython/wxPython/2.8.12.1,wxPython2.8-win32-unicode-2.8.12.1-py27.exe)\
       
   103 	$(wine) $(tmp)/innounp.exe -d$(tmp) -x $$dld
       
   104 	cp -R $(tmp)/\{code_GetPythonDir\}/* $(pydir)
       
   105 	cp -R $(tmp)/\{app\}/* $(pysite)
       
   106 	
       
   107 	# pywin32
       
   108 	$(call get_src_sf,pywin32/pywin32/Build216,pywin32-216.win32-py2.7.exe)\
       
   109 	unzip -d $(tmp)/pw32 $$dld ; [ $$? -eq 1 ] #silence error unziping .exe
       
   110 	cp -R $(tmp)/pw32/PLATLIB/* $(pysite)
       
   111 	cp $(pysite)/pywin32_system32/*.dll $(bin_collect_dir)
       
   112 	
       
   113 	# Twisted
       
   114 	$(call get_src_pypi,2.7/T/Twisted,Twisted-11.0.0.winxp32-py2.7.msi)\
       
   115 	$(msiexec) /qn /a $$dld TARGETDIR=.\\$(pydir)
       
   116 	
       
   117 	# Nevow
       
   118 	$(call get_src_pypi,source/N/Nevow,Nevow-0.10.0.tar.gz)\
       
   119 	tar -C $(tmp) -xvzf $$dld
       
   120 	for i in nevow formless twisted; do cp -R $(tmp)/Nevow-0.10.0/$$i $(pysite); done
       
   121 	
       
   122 	# Numpy
       
   123 	$(call get_src_pypi,2.7/n/numpy,numpy-1.6.1.win32-py2.7.exe)\
       
   124 	unzip -d $(tmp)/np $$dld ; [ $$? -eq 1 ] #silence error unziping .exe
       
   125 	cp -R $(tmp)/np/PLATLIB/* $(pysite)
       
   126 	
       
   127 	# SimpleJson
       
   128 	$(call get_src_pypi,source/s/simplejson,simplejson-2.2.1.tar.gz)\
       
   129 	tar -C $(tmp) -xvzf $$dld
       
   130 	cp -R $(tmp)/simplejson-2.2.1/simplejson/ $(pysite)
       
   131 	
       
   132 	# WxGlade
       
   133 	$(call get_src_http,https://bitbucket.org/agriggio/wxglade/get,b0247325407e.zip)\
       
   134 	unzip -d $(tmp) $$dld 
       
   135 	mv $(tmp)/agriggio-wxglade-b0247325407e $(pysite)/wxglade
       
   136 	
       
   137 	# Pyro
       
   138 	$(call get_src_pypi,source/P/Pyro,Pyro-3.15.tar.gz)\
       
   139 	tar -C $(tmp) -xvzf $$dld
       
   140 	mv $(tmp)/Pyro-3.15/Pyro $(pysite)
       
   141 	
       
   142 	touch python
       
   143 
       
   144 matiecdir = build/matiec
       
   145 matiec: 
       
   146 	$(call get_src_hg,$(tmp)/matiec)
       
   147 	cd $(tmp)/matiec ;\
       
   148 	./configure --host=i586-mingw32msvc;\
       
   149 	make -j$(CPUS);
       
   150 	mkdir $(matiecdir)
       
   151 	mv $(tmp)/matiec/*.exe $(matiecdir)
       
   152 	mv $(tmp)/matiec/lib $(matiecdir)
       
   153 	touch matiec
       
   154 	
       
   155 plcopeneditor:
       
   156 	$(call get_src_hg,build/plcopeneditor)
       
   157 	touch plcopeneditor
       
   158 
       
   159 beremiz:
       
   160 	$(call get_src_hg,build/beremiz)
       
   161 	touch beremiz
       
   162 
       
   163 Beremiz-$(version).exe: python mingw matiec plcopeneditor beremiz
       
   164 	sed -e 's/\$$BVERSION/$(version)/g' $(src)/license.txt > build/license.txt
       
   165 	sed -e 's/\$$BVERSION/$(version)/g' $(src)/install.nsi | makensis - 
       
   166 	
       
   167