OpenCores
URL https://opencores.org/ocsvn/socgen/socgen/trunk

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [soc_link_child] - Blame information for rev 134

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 94 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
 
4
#/**********************************************************************/
5
#/*                                                                    */
6
#/*             -------                                                */
7
#/*            /   SOC  \                                              */
8
#/*           /    GEN   \                                             */
9
#/*          /    TOOL    \                                            */
10
#/*          ==============                                            */
11
#/*          |            |                                            */
12
#/*          |____________|                                            */
13
#/*                                                                    */
14 131 jt_eaton
#/*  Traverse a socgen library and link it                             */
15 94 jt_eaton
#/*                                                                    */
16
#/*                                                                    */
17
#/*  Author(s):                                                        */
18
#/*      - John Eaton, jt_eaton@opencores.org                          */
19
#/*                                                                    */
20
#/**********************************************************************/
21
#/*                                                                    */
22 119 jt_eaton
#/*    Copyright (C) <2010-2012>                */
23 94 jt_eaton
#/*                                                                    */
24
#/*  This source file may be used and distributed without              */
25
#/*  restriction provided that this copyright statement is not         */
26
#/*  removed from the file and that any derivative work contains       */
27
#/*  the original copyright notice and the associated disclaimer.      */
28
#/*                                                                    */
29
#/*  This source file is free software; you can redistribute it        */
30
#/*  and/or modify it under the terms of the GNU Lesser General        */
31
#/*  Public License as published by the Free Software Foundation;      */
32
#/*  either version 2.1 of the License, or (at your option) any        */
33
#/*  later version.                                                    */
34
#/*                                                                    */
35
#/*  This source is distributed in the hope that it will be            */
36
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
37
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
38
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
39
#/*  details.                                                          */
40
#/*                                                                    */
41
#/*  You should have received a copy of the GNU Lesser General         */
42
#/*  Public License along with this source; if not, download it        */
43
#/*  from http://www.opencores.org/lgpl.shtml                          */
44
#/*                                                                    */
45
#/**********************************************************************/
46
 
47
 
48
############################################################################
49
# General PERL config
50
############################################################################
51
use Getopt::Long;
52
use English;
53
use File::Basename;
54 99 jt_eaton
use Cwd;
55
use XML::LibXML;
56 117 jt_eaton
use lib './tools';
57
use sys::lib;
58
use yp::lib;
59 94 jt_eaton
 
60 99 jt_eaton
 
61 94 jt_eaton
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
62
 
63
 
64
 
65
 
66
############################################################################
67
### Process the options
68
############################################################################
69
 
70
Getopt::Long::config("require_order", "prefix=-");
71 99 jt_eaton
GetOptions("h","help",
72 119 jt_eaton
           "prefix=s" => \$prefix,
73 99 jt_eaton
           "vendor=s" => \$vendor,
74 131 jt_eaton
           "library=s" => \$library,
75 94 jt_eaton
           "component=s" => \$component,
76 117 jt_eaton
           "version=s" => \$version
77 119 jt_eaton
 
78 94 jt_eaton
) || die "(use '$program_name -h' for help)";
79
 
80
 
81
##############################################################################
82
## Help option
83
##############################################################################
84 99 jt_eaton
if ( $opt_h or $opt_help  )
85 94 jt_eaton
   {
86 131 jt_eaton
   print "\n type soc_link_child  -prefix /work -vendor vendor_name -library library_name  -component  component_name -version  version_name   ";
87 94 jt_eaton
   print "\n";
88
   exit 1;
89
   }
90
 
91
 
92
##############################################################################
93
##
94
##############################################################################
95
 
96 119 jt_eaton
my $home              = cwd();
97 94 jt_eaton
 
98
 
99 117 jt_eaton
my $parser           = XML::LibXML->new();
100 94 jt_eaton
 
101 131 jt_eaton
 
102 118 jt_eaton
my $variant;
103 117 jt_eaton
 
104 118 jt_eaton
if($version) {$variant = "${component}_${version}";}
105
else         {$variant = "${component}";}
106 117 jt_eaton
 
107
 
108 118 jt_eaton
 
109 94 jt_eaton
#/*********************************************************************************************/
110
#/                                                                                            */
111 131 jt_eaton
#/ link overlay librarys                                                                      */
112 94 jt_eaton
#/                                                                                            */
113 118 jt_eaton
#/*********************************************************************************************/
114
 
115
 
116
 
117
 
118 131 jt_eaton
my $socgen_file     = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
119 118 jt_eaton
 
120
 
121 131 jt_eaton
foreach  my   $i_name ($socgen_file->findnodes("//socgen:syn/socgen:ise/socgen:chip[socgen:variant/text() = '$variant']"))
122 118 jt_eaton
   {
123
   my($replace_vendor)  = $i_name ->findnodes('socgen:target/socgen:vendor/text()')->to_literal ;
124
   my($replace_library)  = $i_name ->findnodes('socgen:target/socgen:library/text()')->to_literal ;
125 130 jt_eaton
   my @replace_components = yp::lib::find_components($replace_vendor,$replace_library);
126 118 jt_eaton
 
127
   foreach my $replace_component (@replace_components)
128
     {
129 131 jt_eaton
      &link_child($vendor, $library,$replace_component, $replace_library ,$replace_vendor);
130 118 jt_eaton
     }
131
   }
132
 
133
 
134
 
135
 
136
 
137 120 jt_eaton
 
138
 
139
 
140 118 jt_eaton
#/*********************************************************************************************/
141 94 jt_eaton
#/                                                                                            */
142
#/                                                                                            */
143
#/                                                                                            */
144
#/                                                                                            */
145 118 jt_eaton
#/                                                                                            */
146
#/                                                                                            */
147 94 jt_eaton
#/*********************************************************************************************/
148
 
149
 
150
 
151
my      @filelist      = (  );
152
 
153 131 jt_eaton
@filelist = yp::lib::parse_component_file("$vendor","$library","$component","$version");
154 120 jt_eaton
 
155 94 jt_eaton
 
156
 
157
 
158
foreach $line (@filelist)
159
   {
160
   $_ = $line;
161 120 jt_eaton
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
162 94 jt_eaton
     {
163 119 jt_eaton
     $new_vendor      = $1;
164
     $new_proj        = $2;
165
     $new_comp        = $3;
166 120 jt_eaton
     $new_version     = $4;
167 131 jt_eaton
     &link_child( $vendor,$library,$new_comp, $new_proj ,$new_vendor);
168 94 jt_eaton
     }
169
   }
170
 
171
 
172
 
173
 
174
 
175
 
176
#/*********************************************************************************************/
177 124 jt_eaton
#/  link the component and software for each child under the parents work/childern dir        */
178 94 jt_eaton
#/                                                                                            */
179
#/                                                                                            */
180
#/                                                                                            */
181
#/                                                                                            */
182
#/                                                                                            */
183
#/*********************************************************************************************/
184
 
185
 
186
 
187
sub link_child {
188 119 jt_eaton
                 my $parent_vendor      = shift;
189
                 my $parent_library      = shift;
190
                 my $child_component = shift;
191
                 my $child_library = shift;
192
                 my $child_vendor = shift;
193
 
194 127 jt_eaton
                 my $lib_comp_sep    = yp::lib::find_lib_comp_sep($child_vendor,$child_library,$child_component);
195 131 jt_eaton
                 my $repo            = yp::lib::find_component_repo($child_vendor,$child_library,$child_component);
196 119 jt_eaton
 
197
 
198 127 jt_eaton
 
199 134 jt_eaton
                 my $path  = ".${prefix}/children";
200 94 jt_eaton
                 mkdir $path,0755             unless( -e $path );
201 134 jt_eaton
                 my $path  = ".${prefix}/children/${child_vendor}__${child_library}";
202 94 jt_eaton
                 mkdir $path,0755             unless( -e $path );
203 134 jt_eaton
                 my $path  = ".${prefix}/children/${child_vendor}__${child_library}/bin";
204 94 jt_eaton
 
205 120 jt_eaton
                 unless( -e $path )
206
                   {
207
                   mkdir $path,0755;
208 131 jt_eaton
                   $root = "${home}/${repo}/${child_vendor}/${child_library}/bin";
209 134 jt_eaton
                   $dest = "${home}${prefix}/children/${child_vendor}__${child_library}/bin";
210 120 jt_eaton
                   &sys::lib::link_dir( "$root", "$dest"  );
211 134 jt_eaton
                   symlink( "${home}/tools/bin/Makefile.root", "${home}${prefix}/children/${child_vendor}__${child_library}/bin/Makefile.root");
212
                   symlink( "${home}/tools/bin/Makefile",      "${home}${prefix}/children/${child_vendor}__${child_library}/bin/Makefile");
213 120 jt_eaton
                   }
214 119 jt_eaton
 
215 115 jt_eaton
 
216 127 jt_eaton
 
217 134 jt_eaton
                   my $path  = ".${prefix}/children/${child_vendor}__${child_library}${lib_comp_sep}";
218 127 jt_eaton
                   mkdir $path,0755             unless( -e $path );
219
 
220 134 jt_eaton
                   my $path  = ".${prefix}/children/${child_vendor}__${child_library}${lib_comp_sep}${child_component}";
221 127 jt_eaton
 
222
 
223
                   unless( -e $path )
224
                   {
225
                   mkdir $path,0755;
226
 
227 131 jt_eaton
                   $root = "${home}/${repo}/${child_vendor}/${child_library}${lib_comp_sep}${child_component}";
228 134 jt_eaton
                   $dest = ".${prefix}/children/${child_vendor}__${child_library}${lib_comp_sep}${child_component}";
229 127 jt_eaton
                   &sys::lib::link_dir( "$root", "$dest"  );
230
 
231
 
232 130 jt_eaton
                   my $socgen_file               = $parser->parse_file(yp::lib::find_componentConfiguration($child_vendor,$child_library,$child_component));
233
                   my $sim_library_path ;
234
                   my $lib_comp_sep             = yp::lib::find_lib_comp_sep($child_vendor,$child_library,$child_component);
235
                   my $sim_comp_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
236 127 jt_eaton
 
237 130 jt_eaton
                   if ($sim_comp_path)
238
                      {
239
                      $sim_library_path            ="${lib_comp_sep}${sim_comp_path}";
240
                      }
241
                   else
242
                      {
243
                      $sim_library_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
244
                      }
245 127 jt_eaton
 
246 134 jt_eaton
                   my $sim_full_path            = ".${prefix}/children/${child_vendor}__${child_library}${sim_library_path}";
247 127 jt_eaton
 
248 130 jt_eaton
 
249 127 jt_eaton
                   if(  $sim_library_path)
250
                     {
251 130 jt_eaton
                      if(-e $sim_full_path)
252
                      {
253 134 jt_eaton
                      my $cmd = "rm -r    .${prefix}/children/${child_vendor}__${child_library}${sim_library_path}  \n";
254 130 jt_eaton
                      if (system($cmd)) {}
255
                      }
256 127 jt_eaton
                     }
257
 
258
 
259 130 jt_eaton
                   my $syn_library_path ;
260
 
261
                   my $syn_comp_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:syn/socgen:comp_path/text()")->to_literal;
262
 
263
                   if ($syn_comp_path)
264
                      {
265
                      $syn_library_path            ="${lib_comp_sep}${syn_comp_path}";
266
                      }
267
                   else
268
                      {
269
                      $syn_library_path           = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:syn/socgen:library_path/text()")->to_literal;
270
                      }
271
 
272
 
273 134 jt_eaton
                   my $syn_full_path            = ".${prefix}/children/${child_vendor}__${child_library}${syn_library_path}";
274 127 jt_eaton
 
275
                   if(  $syn_library_path)
276
                     {
277
                   if(-e $syn_full_path)
278
                    {
279
 
280 134 jt_eaton
                    my $cmd = "rm -r    .${prefix}/children/${child_vendor}__${child_library}${syn_library_path}  \n";
281 127 jt_eaton
                    if (system($cmd)) {}
282
                    }
283
                    }
284
 
285
 
286
 
287
                 }
288
 
289
 
290 120 jt_eaton
                 my $lib_sw_dir     = yp::lib::find_lib_sw_dir($child_vendor,$child_library);
291 115 jt_eaton
 
292 120 jt_eaton
                 if($lib_sw_dir)
293
                   {
294 134 jt_eaton
                   my $path  = ".${prefix}/children/${child_vendor}__${child_library}${lib_sw_dir}";
295 120 jt_eaton
                   unless( -e $path )
296
                     {
297
                     mkdir $path,0755;
298 131 jt_eaton
                     $root = "${home}/${repo}/${child_vendor}/${child_library}${lib_sw_dir}";
299 134 jt_eaton
                     $dest = "${home}${prefix}/children/${child_vendor}__${child_library}${lib_sw_dir}";
300 120 jt_eaton
                     &sys::lib::link_dir( "$root", "$dest"  );
301
                     }
302
                   }
303
 
304 115 jt_eaton
 
305 127 jt_eaton
 
306
 
307
 
308
 
309
 
310
 
311
 
312 94 jt_eaton
               }
313
 
314
 
315
 
316
 
317
 
318 120 jt_eaton
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.