/[scire]/webgli/makedotconf.php
Gentoo

Contents of /webgli/makedotconf.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 50 - (show annotations) (download)
Sun Apr 23 06:31:41 2006 UTC (11 years, 10 months ago) by codeman
File size: 3708 byte(s)
in_array goodness

1 <?php
2 include('webgliIP.php');
3 include('webgliCF.php');
4 include('webgliUtility.php');
5
6 include('Smarty.class.php');
7 $smarty = new Smarty;
8
9 $smarty->template_dir = './templates';
10 $smarty->compile_dir = './templates_c';
11 $smarty->cache_dir = './cache';
12 $smarty->config_dir = './configs';
13
14 $ip = new InstallProfile();
15 $ip->parse('test.xml');
16 $cf = new ClientConfiguration();
17 #$cf->parse('testcc.xml');
18 $etc_files = $ip->get("etc_files");
19 $smarty->assign('dynamic', $ip->get("dynamic_stage3"));
20
21 $error_msg = "";
22 if ($_POST['savemakeconf']) {
23 $cflags = "";
24 $features = " ";
25 if (!array_key_exists("make.conf", $etc_files)) {
26 $etc_files['make.conf'] = array();
27 }
28
29 if ($_POST['proc'] and $_POST['m_thing'] and ($_POST['m_thing'] != "-O0") ) {
30 $cflags .= " ".$_POST['m_thing']."=".$_POST['proc'];
31 }
32 if ($_POST['optim1']) {
33 $cflags .= " ".$_POST['optim1'];
34 }
35 if ($_POST['optim2']) {
36 foreach ($_POST['optim2'] as $param) {
37 $cflags .= " ".$param;
38 }
39 }
40 if ($_POST['optim3']) {
41 $cflags .= " ".$_POST['optim3'];
42 }
43 if ($cflags) {
44 $etc_files['make.conf']['CFLAGS'] = $cflags;
45 }
46
47 if ($_POST['chost']) {
48 $etc_files['make.conf']['CHOST'] = $_POST['chost'];
49 }
50 if ($_POST['unstable']) {
51 $etc_files['make.conf']['ACCEPT_KEYWORDS'] = "~" . $cf->get("architecture_template");
52 }
53 if ($_POST['features']) {
54 $features .= join(" ",$_POST['features']);
55 }
56 if ($_POST['manfeatures']) {
57 $features .= " ".$_POST['manfeatures'];
58 }
59 if ($features) {
60 $etc_files['make.conf']['FEATURES'] = $features;
61 }
62 if (strpos($features,"distcc")) {
63 #Add distcc to the services list.
64 $services = $ip->get("services");
65 if (!in_array("distccd",$services)) {
66 array_push($services, "distccd");
67 }
68 $ip->set("services", $services) or
69 $error_msg .= "ERROR! Could not set the services list.";
70 #Set the distcc flag to emerge earlier than other packages.
71 $ip->set("install_distcc", 1) or
72 $error_msg .= "ERROR! Could not set the install distcc flag!";
73 if ($_POST['distcc']) {
74 $etc_files['make.conf']['DISTCC_HOSTS'] = $_POST['distcc'];
75 }
76 }
77 if ($_POST['makeopts']) {
78 $etc_files['make.conf']['MAKEOPTS'] = $_POST['makeopts'];
79 }
80 $ip->set("etc_files",$etc_files) or
81 $error_msg .= "ERROR! Could not set the make_conf correctly!";
82 file_put_contents('test.xml', $ip->serialize()); #PHP 5 only
83 if (!$error_msg) $error_msg = "Values saved successfully";
84 }
85
86 $arch_procs['x86'] = array("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");
87
88 $smarty->assign('procs',$arch_procs[$cf->get("architecture_template")]);
89
90 $smarty->assign('bigO', array(" ","-O1","-O2 (Recommended)", "-O3", "-O4", "-O5"));
91
92 $arch_chost_options["x86"] = array('i386-pc-linux-gnu', 'i486-pc-linux-gnu', 'i586-pc-linux-gnu', 'i686-pc-linux-gnu');
93 $arch_chost_options["amd64"] = array('x86_64-pc-linux-gnu');
94 $arch_chost_options["alpha"] = array('alpha-unknown-linux-gnu');
95 $arch_chost_options["ppc"] = array('powerpc-unknown-linux-gnu');
96 $arch_chost_options["ppc64"] = array('powerpc64-unknown-linux-gnu');
97 $arch_chost_options["sparc"] = array('sparc-unknown-linux-gnu');
98 $arch_chost_options["sparc64"] = array('sparc-unknown-linux-gnu');
99 $arch_chost_options["hppa"] = array('hppa1.1-unknown-linux-gnu', 'hppa2.0-unknown-linux-gnu');
100 $arch_chost_options["mips"] = array('mips-unknown-linux-gnu');
101 $smarty->assign('arch_chost_options', $arch_chost_options[$cf->get("architecture_template")]);
102
103 $smarty->display('makedotconf.tpl');

  ViewVC Help
Powered by ViewVC 1.1.20