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
|
#! /bin/sh -- # perl
# $Id$
#
# Creates an ACE build tree in directory "build/<build name>" below the current
# directory, which must be a ACE "top level" directory (such as $WRAPPER_ROOT).
# The build tree directory structure mirrors that of the ACE top level
# directory structure, except that instead of containing any plain files,
# it contains only symlinks to the files in the ACE top level structure.
#
# The first line above and the following one let this script run without
# specifying the full path to perl, as long as it is in the user's PATH.
# Taken from perlrun man page.
eval 'exec perl -S $0 ${1+"$@"}'
if 0;
$usage = "usage: $0 -? | [-d <directory mode>] [-v] <build name>\n";
$directory_mode = 042755; #### fine on Suns, but maybe not all Unix platforms
$verbose = 0;
####
#### process command line args
####
while ( $#ARGV >= 0 && $ARGV[0] =~ /^-/ ) {
if ( $ARGV[0] eq '-v' ) {
$verbose = 1;
} elsif ( $ARGV[0] eq '-d' ) {
if ( $ARGV[1] =~ /^\d+$/ ) {
$directory_mode = $ARGV[1]; shift;
} else {
warn "$0: must provide argument for -d option\n";
die $usage;
}
} elsif ( $ARGV[0] eq '-?' ) {
print "$usage";
exit;
} else {
warn "$0: unknown option $ARGV[0]\n";
die $usage;
}
shift;
}
die $usage unless $#ARGV == 0;
$build = $ARGV[0];
####
#### check that we're in an ACE "top level" directory
####
( -d 'ace' && -d 'examples' && -d 'netsvcs' ) ||
die "$0: must be in an ACE top level (WRAPPER_ROOT) directory!\n";
####
#### create build directories, if needed.
####
-d 'build' || mkdir 'build', $directory_mode;
-d "build/$build" || mkdir "build/$build", $directory_mode;
####
#### get all ACE plain file and directory names
####
@files = ( `/usr/bin/find . -name CVS -prune -o -name build -prune -o \\\
-name '.*obj' -prune -o -name Templates.DB -prune -o \\\
\\( ! -type l ! -name core ! -name '*.state' ! -name '*.so' \\\
! -name '*.[oa]' ! -name '*~' ! -name '.' ! -name '.#*' \\\
! -name '*.log' \\) \\\
-print` );
####
#### create directories and symlinks to files
####
foreach $file ( @files ) {
chop $file; #### remove trailing newline (from find command above)
$file =~ s%^\./%%g; #### excise leading ./ directory component
if ( -d $file ) {
print "mkdir build/$build/$file, $directory_mode\n" if $verbose;
-d "build/$build/$file" || mkdir "build/$build/$file",
$directory_mode;
} else {
$up = '../..';
while ( $file =~ m%/%g ) { $up .= '/..'; }
print "symlink $up/$file build/$build/$file\n" if $verbose;
symlink "$up/$file", "build/$build/$file" ||
die "$0 symlink to build/$build/$file failed\n";
}
}
####
#### create symlink to ChangeLog symlink
####
symlink '../../ChangeLog', "build/$build/ChangeLog" ||
die "$0: unable to create build/$build/ChangeLog symlink\n";
####
#### done: print message
####
print "\nCompleted creation of build/$build/.\n" .
"Be sure to setup build/$build/ace/config.h and\n" .
"build/$build/include/makeinclude/platform_macros.GNU symlinks.\n";
#### EOF
|