aboutsummaryrefslogtreecommitdiff
blob: 4ee10edf35902624c7f5ccd0d3794a6fdd39e9d7 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<? include /webgli/top.pyhtml ?>
<?
error_msg = ""
if post_params:
	cflags = ""
	features = ""
	etc_files = shared_info.install_profile.get_etc_files()
	if etc_files.has_key("make.conf"):
		make_conf = etc_files['make.conf']
		if "CFLAGS" in make_conf:
			cflags = make_conf['CFLAGS']
		if "FEATURES" in make_conf:
			features = make_conf['FEATURES']
	else:
		make_conf = {}
	if post_params['proc'] and post_params['m_thing']:
		cflags += " "+post_params['m_thing']+"="+post_params['proc']
	if post_params['optim1']:
		cflags += " "+post_params['optim1']
	if post_params['optim2']:
		if isinstance(post_params['optim2'], list):
			for param in post_params['optim2']:
				cflags += " "+param
		else:
			cflags += " "+post_params['optim2']
	if post_params['optim3']:
		cflags += " "+post_params['optim3']
	make_conf['CFLAGS'] = cflags
	if post_params['chost']:
		make_conf['CHOST'] = post_params['chost']
	if post_params['unstable']:
		make_conf['ACCEPT_KEYWORDS'] = "~" + shared_info.client_profile.get_architecture_template()
	if post_params['features']:
		if isinstance(post_params['features'], list):
			features = " ".join(post_params['features'])
		else:
			features = post_params['features']
	if post_params['manfeatures']:
		features += " "+post_params['manfeatures']
	if "distcc" in features:
		#Add distcc to the services list.
		if shared_info.install_profile.get_services():
			services = shared_info.install_profile.get_services()
			if isinstance(services, str):
				services = services.split(',')
		else:
			services = []
		if not "distccd" in services:
			services.append("distccd")
		try:
			services = ",".join(services)
			if services:
				shared_info.install_profile.set_services(None, services, None)
		except:
			error_msg = _(u"ERROR! Could not set the services list.")
		#Set the distcc flag to emerge earlier than other packages.
		try:
			shared_info.install_profile.set_install_distcc(None, True, None)
		except:
			error_msg = _(u"ERROR! Could not set the install distcc flag!")
		if post_params['distcc']:
			try:
				make_conf['DISTCC_HOSTS'] = post_params['distcc']
			except:
				error_msg = "ERROR! Could not set the distcc hosts!"
	make_conf['FEATURES'] = features
	if post_params['makeopts']:
		make_conf['MAKEOPTS'] = post_params['makeopts']
	try:
		if make_conf:
			etc_files['make.conf'] = make_conf
			shared_info.install_profile.set_etc_files(etc_files)
	except:
		error_msg = _(u"ERROR! Could not set the make_conf correctly!")
	if not error_msg:
		error_msg = "Values saved successfully"

arch_procs = { 'x86': ("i386", "i486", "i586", "pentium", "pentium-mmx", "i686", "pentiumpro", "pentium2", "pentium3", "pentium3m", "pentium-m", "pentium4", "pentium4m", "prescott", "nocona", "k6", "k6-2", "k6-3", "athlon", "athlon-tbird", "athlon-4", "athlon-xp", "athlon-mp", "k8", "opteron", "athlon64", "athlon-fx", "winchip-c6", "winchip2", "c3", "c3-2") }
etc_files = shared_info.install_profile.get_etc_files()
if etc_files.has_key("make.conf"):
	make_conf = etc_files['make.conf']
else:
	make_conf = {}
procs = arch_procs[shared_info.client_profile.get_architecture_template()]
?>
<b>Make.conf Settings:</b><br>
<: if error_msg:
<br><% error_msg %><br><br>
:>
<: if shared_info.install_profile.get_dynamic_stage3():
<b>You have selected a dynamic stage3 installation.  This setting forbids you from changing some make.conf settings until after the installation to prevent breaking the stage3 creation process.</b>
:>
<b>NOTE: Your old values are NOT loaded here.  Do not save these settings without making sure all values are what you want.  To keep your old values just skip this step.</b>
<form action="/webgli/makedotconf.pyhtml" method="POST" enctype="multipart/form-data">
<h3>CFLAGS Settings: </h3>
(only show these if not dynamic):
<table width="100%" border="1">
  <tr>
    <td scope="col"><div align="left">Processor:<select name="proc" id="proc">
<: for proc in procs:
      <option value="<% proc %>"><% proc %></option>
:>
      </select><br><input type="radio" name"m_thing" value="-march">-march <input type="radio" name"m_thing" value="-mcpu">-mcpu <input type="radio" name"m_thing" value="-mtune">-mtune </div></td>
    <td scope="col">Optimizations: <select name="optim1" id="optim1">
<: for i in range(1, 9):
      <option value="-O<% str(i) %>">-O<% str(i) %><? if i == 2: print " (Recommended)" ?></option>
:>
      </select></td>
  </tr>
  <tr>
    <td>Common CFLAGS:<br><input name="optim2" type="checkbox" id="optim2" value="-pipe">-pipe<br><input name="optim2" type="checkbox" id="optim2" value="-fomit-frame-pointer">-fomit-frame-pointer</td>
    <td>Additional CFLAGS: <input name="optim3" type="text" id="optim3" size="60"></td>
  </tr>
</table>
<hr>
<h3>CHOST Setting:</h3>
<select name="chost" size="4" id="chost" <? if shared_info.install_profile.get_dynamic_stage3(): print "disabled" ?>>
<?
arch_chost_options = { "x86": ('i386-pc-linux-gnu', 'i486-pc-linux-gnu', 'i586-pc-linux-gnu', 'i686-pc-linux-gnu'),
                       "amd64": ('x86_64-pc-linux-gnu',),
                       "alpha": ('alpha-unknown-linux-gnu',),
                       "ppc": ('powerpc-unknown-linux-gnu',),
                       "ppc64": ('powerpc64-unknown-linux-gnu',),
                       "sparc": ('sparc-unknown-linux-gnu',),
                       "sparc64": ('sparc-unknown-linux-gnu',),
                       "hppa": ('hppa1.1-unknown-linux-gnu', 'hppa2.0-unknown-linux-gnu'),
                       "mips": ('mips-unknown-linux-gnu',) }
?>
<: for arch_chost_option in arch_chost_options[shared_info.client_profile.get_architecture_template()]:
<option value="<% arch_chost_option %>"><% arch_chost_option %></option>
:>
</select>
<hr>
<table width="100%"  border="1">
  <tr>
    <td scope="col"><input name="unstable" type="checkbox" id="unstable" value="unstable" <? if shared_info.install_profile.get_dynamic_stage3(): print "disabled" ?>>	Use unstable (~arch) </td>
    <td scope="col"><input name="features" type="checkbox" id="binary" value="buildpkg"> Build binary packages (buildpkg)</td>
    <td scope="col"><input name="features" type="checkbox" id="ccache" value="ccache"> ccache</td>
    <td scope="col"><input name="features" type="checkbox" id="sandbox" value="sandbox"> sandbox</td>
  </tr>
  <tr>
    <td scope="col"><input name="features" type="checkbox" id="distlocks" value="distlocks"> distlocks</td>
    <td scope="col"><input name="features" type="checkbox" id="prelink" value="prelink"> prelink</td>
    <td scope="col">More Features: <input name="manfeatures" type="text" id="manfeatures" size="10"></td>
    <td scope="col">MAKEOPTS: <input name="makeopts" type="text" id="makeopts" value="-j2" size="10" maxlength="5"></td>
  </tr>
  <tr>
    <td scope="col"><input name="features" type="checkbox" id="distcc" value="distcc"> Distcc</td>
    <td>Distcc Config Line:<input name="distcc" type="text" size="80"></td>
  </tr>
</table>
<p>
<input name="savemakeconf" type="submit" id="savemakeconf" value="Save Make.Conf Settings">
</p>
</form>
<? include /webgli/bottom.pyhtml ?>