-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
executable file
·55 lines (38 loc) · 1.27 KB
/
build.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/python2.7
import os, sys, urllib, tarfile, subprocess, glob
environment = [
'src',
'src/pcc',
'src/nim',
'build',
'build/pcc',
'build/nim',
'eval'
]
print('creating environment...')
for folder in environment:
next = './' + folder
if not os.path.exists(next):
os.makedirs(next)
print('environment created.')
print('generating eval/eval.nim.cfg...')
handle = open('eval/eval.nim.cfg', 'w')
handle.write('arm64.linux.ucc.exe = "./build/pcc/pcc"')
handle.write('ucc.options.linker = "-ldl"')
handle.close()
print('eval/eval.nim.cfg generated.')
print('setting up Portable C Compiler...')
print(' downloading Portable C Compiler (pcc.tgz) to src/pcc/pcc.tgz...')
urllib.urlretrieve('ftp://pcc.ludd.ltu.se/pub/pcc/pcc-current.tgz', 'src/pcc/pcc.tgz')
print(' Portable C Compiler downloaded to src/pcc/pcc.tgz.')
print(' Unpacking src/pcc/pcc.tgz...')
tar = tarfile.open('src/pcc/pcc.tgz', 'r')
for item in tar:
tar.extract(item, 'src/pcc/')
print(' src/pcc/pcc.tgz unpacked.')
print(' building build/pcc/pcc...')
os.chdir('build/pcc')
subprocess.call([glob.glob("../../src/pcc/pcc-*/configure")[0], '--prefix=' + os.getcwd() + 'build/pcc'])
subprocess.call(['make'])
subprocess.call(['make', 'install'])
print(' build/pcc/pcc built.')