summaryrefslogtreecommitdiff
path: root/manual tests/4 standalone binaries/build_windows_package.py
blob: c676113f3478658175c84bd93d29feaec234f0e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3

import os, urllib.request, shutil, subprocess
from glob import glob

sdl_url = 'http://libsdl.org/release/SDL2-devel-2.0.3-VC.zip'
sdl_filename = 'SDL2-devel-2.0.3-VC.zip'
sdl_dir = 'SDL2-2.0.3'

shutil.rmtree('build', ignore_errors=True)
os.mkdir('build')

if not os.path.exists(sdl_filename):
    response = urllib.request.urlopen(sdl_url)
    data = response.read()
    open(sdl_filename, 'wb').write(data)

shutil.unpack_archive(sdl_filename, 'build')

libs = glob(os.path.join('build', sdl_dir, 'lib/x86/*'))
[shutil.copy(x, 'build') for x in libs]

# Sorry for this hack but this needs to work during development
# when Meson is not in path.
subprocess.check_call(['python3', r'..\..\meson.py', 'build',
                        '--backend=ninja', '--buildtype=release'])
subprocess.check_call(['ninja'], cwd='build')
shutil.copy('myapp.iss', 'build')
subprocess.check_call([r'\Program Files\Inno Setup 5\ISCC.exe', 'myapp.iss'],
                       cwd = 'build')
shutil.copy('build/setup.exe', 'myapp 1.0.exe')
shutil.rmtree('build')