Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
7d9ccd90
Commit
7d9ccd90
authored
Mar 31, 1999
by
Bruce Korb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked method for traversing sym-linked directory hierarchies
From-SVN: r26086
parent
5877286e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
87 deletions
+150
-87
gcc/fixinc/fixincl.c
+38
-8
gcc/fixinc/hackshell.tpl
+27
-29
gcc/fixinc/inclhack.tpl
+85
-50
No files found.
gcc/fixinc/fixincl.c
View file @
7d9ccd90
...
@@ -139,6 +139,8 @@ struct fix_desc
...
@@ -139,6 +139,8 @@ struct fix_desc
char
*
pz_dest_dir
=
NULL
;
char
*
pz_dest_dir
=
NULL
;
char
*
pz_src_dir
=
NULL
;
char
*
pz_src_dir
=
NULL
;
char
*
pz_machine
=
NULL
;
char
*
pz_machine
=
NULL
;
char
*
pz_find_base
=
NULL
;
int
find_base_len
=
0
;
pid_t
process_chain_head
=
(
pid_t
)
-
1
;
pid_t
process_chain_head
=
(
pid_t
)
-
1
;
...
@@ -240,6 +242,17 @@ main (argc, argv)
...
@@ -240,6 +242,17 @@ main (argc, argv)
}
}
}
}
{
static
const
char
var
[]
=
"FIND_BASE"
;
pz_find_base
=
getenv
(
var
);
if
(
pz_find_base
==
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
var_not_found
,
var
);
exit
(
EXIT_FAILURE
);
}
find_base_len
=
strlen
(
pz_find_base
);
}
/* Compile all the regular expressions now.
/* Compile all the regular expressions now.
That way, it is done only once for the whole run.
That way, it is done only once for the whole run.
*/
*/
...
@@ -298,10 +311,15 @@ main (argc, argv)
...
@@ -298,10 +311,15 @@ main (argc, argv)
errno
,
strerror
(
errno
));
errno
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
#ifdef DEBUG
#ifndef DEBUG
{
int
status
;
(
void
)
wait
(
&
status
);
}
#else
fprintf
(
stderr
,
"Waiting for %d to complete %d files
\n
"
,
fprintf
(
stderr
,
"Waiting for %d to complete %d files
\n
"
,
child
,
file_name_ct
);
child
,
file_name_ct
);
#endif
{
{
int
status
;
int
status
;
pid_t
dead_kid
=
wait
(
&
status
);
pid_t
dead_kid
=
wait
(
&
status
);
...
@@ -309,17 +327,18 @@ main (argc, argv)
...
@@ -309,17 +327,18 @@ main (argc, argv)
if
(
dead_kid
!=
child
)
if
(
dead_kid
!=
child
)
fprintf
(
stderr
,
"fixincl woke up from a strange child %d (not %d)
\n
"
,
fprintf
(
stderr
,
"fixincl woke up from a strange child %d (not %d)
\n
"
,
dead_kid
,
child
);
dead_kid
,
child
);
#ifdef DEBUG
else
else
fprintf
(
stderr
,
"child finished %d files %s
\n
"
,
file_name_ct
,
fprintf
(
stderr
,
"child finished %d files %s
\n
"
,
file_name_ct
,
status
?
strerror
(
status
&
0xFF
)
:
"ok"
);
status
?
strerror
(
status
&
0xFF
)
:
"ok"
);
#endif
}
}
#endif
}
}
#else
#else
#error "NON-BOGUS LIMITS NOT SUPPORTED?!?!"
#error "NON-BOGUS LIMITS NOT SUPPORTED?!?!"
#endif
#endif
signal
(
SIGCLD
,
SIG_IGN
);
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"Child start -- processing %d files
\n
"
,
fprintf
(
stderr
,
"Child start -- processing %d files
\n
"
,
file_name_ct
);
file_name_ct
);
...
@@ -411,8 +430,10 @@ load_file (pz_file_name)
...
@@ -411,8 +430,10 @@ load_file (pz_file_name)
if
(
ferror
(
fp
))
if
(
ferror
(
fp
))
{
{
fprintf
(
stderr
,
"error %d (%s) reading %s
\n
"
,
errno
,
int
err
=
errno
;
strerror
(
errno
),
pz_file_name
);
if
(
err
!=
EISDIR
)
fprintf
(
stderr
,
"error %d (%s) reading %s
\n
"
,
err
,
strerror
(
err
),
pz_file_name
);
free
((
void
*
)
pz_data
);
free
((
void
*
)
pz_data
);
fclose
(
fp
);
fclose
(
fp
);
return
(
char
*
)
NULL
;
return
(
char
*
)
NULL
;
...
@@ -596,7 +617,16 @@ create_file (pz_file_name)
...
@@ -596,7 +617,16 @@ create_file (pz_file_name)
FILE
*
pf
;
FILE
*
pf
;
char
fname
[
MAXPATHLEN
];
char
fname
[
MAXPATHLEN
];
sprintf
(
fname
,
"%s/%s"
,
pz_dest_dir
,
pz_file_name
);
#ifdef DEBUG
if
(
strncmp
(
pz_file_name
,
pz_find_base
,
find_base_len
)
!=
0
)
{
fprintf
(
stderr
,
"Error: input file %s does not match %s/*
\n
"
,
pz_file_name
,
pz_find_base
);
exit
(
1
);
}
#endif
sprintf
(
fname
,
"%s/%s"
,
pz_dest_dir
,
pz_file_name
+
find_base_len
);
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRALL
);
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRALL
);
...
@@ -911,7 +941,7 @@ process (pz_data, pz_file_name)
...
@@ -911,7 +941,7 @@ process (pz_data, pz_file_name)
}
}
}
}
fprintf
(
stderr
,
"Applying %-
32
s to %s
\n
"
,
fprintf
(
stderr
,
"Applying %-
24
s to %s
\n
"
,
p_fixd
->
fix_name
,
pz_file_name
);
p_fixd
->
fix_name
,
pz_file_name
);
/* IF we do not have a read pointer,
/* IF we do not have a read pointer,
...
...
gcc/fixinc/hackshell.tpl
View file @
7d9ccd90
...
@@ -5,19 +5,15 @@
...
@@ -5,19 +5,15 @@
# fixincl program. It is the repetitive guts of the fixincludes logic.
# fixincl program. It is the repetitive guts of the fixincludes logic.
#
#
=]
=]
if $LINKS; then
files=`find . -name '*.h' \( -type f -o -type l \) -print`
else
files=`find . -name '*.h' -type f -print`
fi
echo Checking header files
echo Checking header files
for file in $files; do
for file in $files; do
if ( test ! -r $
file
-o \
if ( test ! -r $
{
file
}
-o \
-n "`fgrep 'This file is part of the GNU C Library' $
file
`" )
-n "`fgrep 'This file is part of the GNU C Library' $
{
file
}
`" )
then continue ; fi
then continue ; fi
fixlist=""
fixlist=""
DESTFILE=$
{
DESTDIR
}
/`echo $
{
file
}
| sed "s;$
{
FIND_BASE
}
/;;" `
[=
[=
#
#
# FOR every fix description,
# FOR every fix description,
...
@@ -30,7 +26,7 @@ _FOR fix "\n\n" =]
...
@@ -30,7 +26,7 @@ _FOR fix "\n\n" =]
# Fix [=_eval _index 1 + #%3d _printf=]: [=hackname _Cap=]
# Fix [=_eval _index 1 + #%3d _printf=]: [=hackname _Cap=]
#[=
#[=
_IF files _exist=]
_IF files _exist=]
case "$
file
" in [=_FOR files " | \\\n\t"=]./[=files=][=/files=] )[=
case "$
{
file
}
" in [=_FOR files " | \\\n\t"=]./[=files=][=/files=] )[=
_ENDIF=][=
_ENDIF=][=
_IF mach _exist=]
_IF mach _exist=]
...
@@ -52,8 +48,8 @@ _FOR fix "\n\n" =]
...
@@ -52,8 +48,8 @@ _FOR fix "\n\n" =]
true or false. It is enclosed in parenthesis to avoid
true or false. It is enclosed in parenthesis to avoid
precedence problems. The output looks like this:
precedence problems. The output looks like this:
if ( test -n "`egrep 'find-expr' $
file
`" -a
if ( test -n "`egrep 'find-expr' $
{
file
}
`" -a
-z "`egrep 'not-find' $
file
`" -a
-z "`egrep 'not-find' $
{
file
}
`" -a
'('
<some-test-expression>
')'
'('
<some-test-expression>
')'
) > /dev/null 2>
&
1 ; then
) > /dev/null 2>
&
1 ; then
...
@@ -62,13 +58,13 @@ _FOR fix "\n\n" =]
...
@@ -62,13 +58,13 @@ _FOR fix "\n\n" =]
_IF select _exist =]
_IF select _exist =]
if ( test [=
if ( test [=
_FOR select " -a \\\n "
_FOR select " -a \\\n "
=]-n [=select _shrstr "#`egrep %s $
file
`"
=]-n [=select _shrstr "#`egrep %s $
{
file
}
`"
_printf _shstr =][=
_printf _shstr =][=
/select=][=
/select=][=
_IF bypass _exist =][=
_IF bypass _exist =][=
_FOR bypass=] -a \
_FOR bypass=] -a \
-z [=bypass _shrstr "#`egrep %s $
file
`"
-z [=bypass _shrstr "#`egrep %s $
{
file
}
`"
_printf _shstr =][=
_printf _shstr =][=
/bypass=][=
/bypass=][=
_ENDIF=][=
_ENDIF=][=
...
@@ -89,7 +85,7 @@ _FOR fix "\n\n" =]
...
@@ -89,7 +85,7 @@ _FOR fix "\n\n" =]
_IF bypass _exist=][=
_IF bypass _exist=][=
_FOR bypass=] -a \
_FOR bypass=] -a \
-z [=bypass _shrstr "#`egrep %s $
file
`"
-z [=bypass _shrstr "#`egrep %s $
{
file
}
`"
_printf _shstr=][=
_printf _shstr=][=
/bypass=][=
/bypass=][=
_ENDIF=]
_ENDIF=]
...
@@ -98,16 +94,16 @@ _FOR fix "\n\n" =]
...
@@ -98,16 +94,16 @@ _FOR fix "\n\n" =]
_ELIF bypass _exist =]
_ELIF bypass _exist =]
if ( test [=_FOR bypass " -a \\\n "
if ( test [=_FOR bypass " -a \\\n "
=]-z [=bypass _shrstr "#`egrep %s $
file
`"
=]-z [=bypass _shrstr "#`egrep %s $
{
file
}
`"
_printf _shstr=][=/bypass=]
_printf _shstr=][=/bypass=]
) > /dev/null 2>
&
1 ; then[=
) > /dev/null 2>
&
1 ; then[=
_ENDIF=]
_ENDIF=]
fixlist="$
{
fixlist
}
fixlist="$
{
fixlist
}
[=hackname=]"
[=hackname=]"
if [ ! -r $
{
DEST
DIR
}
/$file
]
if [ ! -r $
{
DEST
FILE
}
]
then infile=$
file
then infile=$
{
file
}
else infile=$
{
DEST
DIR
}
/$file
; fi [=
else infile=$
{
DEST
FILE
}
; fi [=
_IF sed _exist=][=
_IF sed _exist=][=
_IF shell _exist =][=
_IF shell _exist =][=
...
@@ -118,16 +114,16 @@ _FOR fix "\n\n" =]
...
@@ -118,16 +114,16 @@ _FOR fix "\n\n" =]
sed [=
sed [=
_FOR sed =]-e [=sed _shrstr=] \
_FOR sed =]-e [=sed _shrstr=] \
[=
[=
/sed=]
<
$
infile
>
$
{
DEST
DIR
}
/$file
.[=
/sed=]
<
$
infile
>
$
{
DEST
FILE
}
.[=
_ELIF shell _exist =]
_ELIF shell _exist =]
( [=shell=] )
<
$
infile
>
$
{
DESTDIR
}
/
$file.
( [=shell=] )
<
$
infile
>
$
{
DESTDIR
}
/
FIXINC.tmp
# Shell scripts have the potential of removing the output
# Shell scripts have the potential of removing the output
# We interpret that to mean the file is not to be altered
# We interpret that to mean the file is not to be altered
#
#
if test ! -f $
{
DESTDIR
}
/
$file.
if test ! -f $
{
DESTDIR
}
/
fixinc.tmp
then continue ; fi [=
then continue ; fi [=
...
@@ -135,8 +131,8 @@ _FOR fix "\n\n" =]
...
@@ -135,8 +131,8 @@ _FOR fix "\n\n" =]
_ERROR hackname _get "ERROR: %s has no fixup" _printf=][=
_ERROR hackname _get "ERROR: %s has no fixup" _printf=][=
_ENDIF=]
_ENDIF=]
rm -f $
{
DESTFILE
}
mv -f $
{
DESTDIR
}
/
$file. $
{
DESTDIR
}
/$file
[=
mv -f $
{
DESTDIR
}
/
fixinc.tmp $
{
DESTFILE
}
[=
# Close off any opened "if" or "case" statements in reverse order
# Close off any opened "if" or "case" statements in reverse order
...
@@ -165,21 +161,23 @@ _FOR fix "\n\n" =]
...
@@ -165,21 +161,23 @@ _FOR fix "\n\n" =]
# THEN ensure the output is gone
# THEN ensure the output is gone
# ELSE look for local directory include syntax
# ELSE look for local directory include syntax
#
#
if ( test ! -f $
{
DEST
DIR
}
/$file
|| \
if ( test ! -f $
{
DEST
FILE
}
|| \
cmp $
file $
{
DESTDIR
}
/$file
) > /dev/null 2>
&
1
cmp $
{
file
}
$
{
DESTFILE
}
) > /dev/null 2>
&
1
then
then
rm -f $
{
DEST
DIR
}
/$file
rm -f $
{
DEST
FILE
}
else
else
echo "Fixed $
file
:$
{
fixlist
}
"
echo "Fixed $
{
file
}
:$
{
fixlist
}
"
# Find any include directives that use "file".
# Find any include directives that use "file".
#
#
dir=`echo $
{
file
}
| sed -e s';/[^/]*$;;'`
ddir=`echo $
{
DESTDIR
}
| sed 's;/[^/]*$;;'`/$dir
for include in `
for include in `
egrep '^[
]*#[ ]*include[ ]*"[^/]' $
{
DESTDIR
}
/$file
|
egrep '^[
]*#[ ]*include[ ]*"[^/]' $
{
DESTFILE
}
|
sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
do
do
dir=`echo $file | sed -e s'|/[^/]*$||'`
required="$required $
{
SRCDIR
}
$dir/$include $
{
ddir
}
/$include"
required="$required $
{
SRCDIR
}
$dir/$include $
{
DESTDIR
}
/$dir/$include"
done
done
fi
fi
done # for file in $files
done # for file in $files
gcc/fixinc/inclhack.tpl
View file @
7d9ccd90
...
@@ -116,6 +116,7 @@ for INPUT in ${INPUTLIST} ; do
...
@@ -116,6 +116,7 @@ for INPUT in ${INPUTLIST} ; do
cd $
{
ORIGDIR
}
cd $
{
ORIGDIR
}
cd $
{
INPUT
}
|| continue
cd $
{
INPUT
}
|| continue
INPUT=`$
{
PWDCMD
}
`
#
#
# # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # #
...
@@ -123,13 +124,16 @@ cd ${INPUT} || continue
...
@@ -123,13 +124,16 @@ cd ${INPUT} || continue
echo Finding directories and links to directories
echo Finding directories and links to directories
# Find all directories and all symlinks that point to directories.
# Find all directories and all symlinks that point to directories.
# Put the list in $
file
s.
# Put the list in $
all_dir
s.
# Each time we find a symlink, add it to newdirs
# Each time we find a symlink, add it to newdirs
# so that we do another find within the dir the link points to.
# so that we do another find within the dir the link points to.
# Note that $
file
s may have duplicates in it;
# Note that $
all_dir
s may have duplicates in it;
# later parts of this file are supposed to ignore them.
# later parts of this file are supposed to ignore them.
dirs="."
dirs="."
levels=2
levels=2
all_dirs=""
search_dirs=""
while [ -n "$dirs" ]
&&
[ $levels -gt 0 ]
while [ -n "$dirs" ]
&&
[ $levels -gt 0 ]
do
do
levels=`expr $levels - 1`
levels=`expr $levels - 1`
...
@@ -140,7 +144,7 @@ do
...
@@ -140,7 +144,7 @@ do
# Find all directories under $d, relative to $d, excluding $d itself.
# Find all directories under $d, relative to $d, excluding $d itself.
# (The /. is needed after $d in case $d is a symlink.)
# (The /. is needed after $d in case $d is a symlink.)
files="$file
s `find $d/. -type d -print | \
all_dirs="$all_dir
s `find $d/. -type d -print | \
sed -e '/\/\.$/d' -e 's@/./@/@g'`"
sed -e '/\/\.$/d' -e 's@/./@/@g'`"
# Find all links to directories.
# Find all links to directories.
# Using `-exec test -d' in find fails on some systems,
# Using `-exec test -d' in find fails on some systems,
...
@@ -156,10 +160,11 @@ do
...
@@ -156,10 +160,11 @@ do
# add that dir to $newdirs
# add that dir to $newdirs
if [ -d $d1 ]
if [ -d $d1 ]
then
then
files="$file
s $d1"
all_dirs="$all_dir
s $d1"
if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
then
then
newdirs="$newdirs $d1"
newdirs="$newdirs $d1"
search_dirs="$search_dirs $d1"
fi
fi
fi
fi
done
done
...
@@ -172,9 +177,9 @@ done
...
@@ -172,9 +177,9 @@ done
#
#
dirs=
dirs=
echo "All directories (including links to directories):"
echo "All directories (including links to directories):"
echo $
file
s
echo $
all_dir
s
for file in $
file
s; do
for file in $
all_dir
s; do
rm -rf $LIB/$file
rm -rf $LIB/$file
if [ ! -d $LIB/$file ]
if [ ! -d $LIB/$file ]
then mkdir $LIB/$file
then mkdir $LIB/$file
...
@@ -187,53 +192,67 @@ mkdir $LIB/root
...
@@ -187,53 +192,67 @@ mkdir $LIB/root
# treetops gets an alternating list
# treetops gets an alternating list
# of old directories to copy
# of old directories to copy
# and the new directories to copy to.
# and the new directories to copy to.
treetops="
$
{
INPUT
}
$
{
LIB
}
"
treetops="
.
$
{
LIB
}
"
if $LINKS; then
if $LINKS; then
echo 'Making symbolic directory links'
echo 'Making symbolic directory links'
for file in $files; do
dest=`ls -ld $file | sed -n 's/.*-> //p'`
if [ "$dest" ]; then
cwd=`$
{
PWDCMD
}
`
cwd=`$
{
PWDCMD
}
`
# In case $dest is relative, get to $file's dir first.
for sym_link in $search_dirs; do
cd $
{
INPUT
}
cd $
{
INPUT
}
cd `echo ./$file | sed -n 's
&
[^/]*$
&&
p'`
dest=`ls -ld $
{
sym_link
}
| sed -n 's/.*-> //p'`
# In case $dest is relative, get to $
{
sym_link
}
's dir first.
#
cd ./`echo $
{
sym_link
}
| sed 's;/[^/]*$;;'`
# Check that the target directory exists.
# Check that the target directory exists.
# Redirections changed to avoid bug in sh on Ultrix.
# Redirections changed to avoid bug in sh on Ultrix.
#
(cd $dest) > /dev/null 2>
&
1
(cd $dest) > /dev/null 2>
&
1
if [ $? = 0 ]; then
if [ $? = 0 ]; then
cd $dest
cd $dest
# X gets the dir that the link actually leads to.
x=`$
{
PWDCMD
}
`
# full_dest_dir gets the dir that the link actually leads to.
#
full_dest_dir=`$
{
PWDCMD
}
`
# Canonicalize $
{
INPUT
}
now to minimize the time an
# Canonicalize $
{
INPUT
}
now to minimize the time an
# automounter has to change the result of $
{
PWDCMD
}
.
# automounter has to change the result of $
{
PWDCMD
}
.
#
cinput=`cd $
{
INPUT
}
; $
{
PWDCMD
}
`
cinput=`cd $
{
INPUT
}
; $
{
PWDCMD
}
`
# If a link points to ., make a similar link to .
# If a link points to ., make a similar link to .
if [ $x = $
{
cinput
}
]; then
#
echo $file '->' . ': Making link'
if [ $
{
full_dest_dir
}
= $
{
cinput
}
]; then
rm -fr $
{
LIB
}
/$file > /dev/null 2>
&
1
echo $
{
sym_link
}
'->' . ': Making self link'
ln -s . $
{
LIB
}
/$file > /dev/null 2>
&
1
rm -fr $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
ln -s . $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
# If link leads back into $
{
INPUT
}
,
# If link leads back into $
{
INPUT
}
,
# make a similar link here.
# make a similar link here.
elif expr $x : "$
{
cinput
}
/.*" > /dev/null; then
#
elif expr $
{
full_dest_dir
}
: "$
{
cinput
}
/.*" > /dev/null; then
# Y gets the actual target dir name, relative to $
{
INPUT
}
.
# Y gets the actual target dir name, relative to $
{
INPUT
}
.
y=`echo $x
| sed -n "s
&
$
{
cinput
}
/
&&
p"`
y=`echo $
{
full_dest_dir
}
| sed -n "s
&
$
{
cinput
}
/
&&
p"`
# DOTS is the relative path from $
{
LIB
}
/$file's dir
back to $
{
LIB
}
.
# DOTS is the relative path from $
{
LIB
}
/$
{
sym_link
}
back to $
{
LIB
}
.
dots=`echo "$file
" |
dots=`echo "$
{
sym_link
}
" |
sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
echo $file '->' $dots$y ': Making link'
echo $
{
sym_link
}
'->' $dots$y ': Making local link'
rm -fr $
{
LIB
}
/$file > /dev/null 2>
&
1
rm -fr $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
ln -s $dots$y $
{
LIB
}
/$file > /dev/null 2>
&
1
ln -s $dots$y $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
else
else
# If the link is to a dir $target outside $
{
INPUT
}
,
# If the link is to a dir $target outside $
{
INPUT
}
,
# repoint the link at $
{
INPUT
}
/root$target
# repoint the link at $
{
INPUT
}
/root$target
# and process $target into $
{
INPUT
}
/root$target
# and process $target into $
{
INPUT
}
/root$target
# treat this directory as if it actually contained the files.
# treat this directory as if it actually contained the files.
echo $file '->' root$x ': Making link'
#
if [ -d $LIB/root$x ]
echo $
{
sym_link
}
'->' root$
{
full_dest_dir
}
': Making rooted link'
if [ -d $LIB/root$
{
full_dest_dir
}
]
then true
then true
else
else
dirname=root$x
/
dirname=root$
{
full_dest_dir
}
/
dirmade=.
dirmade=.
cd $LIB
cd $LIB
while [ x$dirname != x ]; do
while [ x$dirname != x ]; do
...
@@ -244,13 +263,16 @@ if $LINKS; then
...
@@ -244,13 +263,16 @@ if $LINKS; then
dirname=`echo $dirname | sed -e 's|[^/]*/||'`
dirname=`echo $dirname | sed -e 's|[^/]*/||'`
done
done
fi
fi
# Duplicate directory structure created in $
{
LIB
}
/$file in new
# Duplicate directory structure created in $
{
LIB
}
/$
{
sym_link
}
in new
# root area.
# root area.
for file2 in $files; do
#
for file2 in $all_dirs; do
case $file2 in
case $file2 in
$file/*)
$
{
sym_link
}
/*)
dupdir=$
{
LIB
}
/root$x/`echo $file2 | sed -n "s|^$
{
file
}
/||p"`
dupdir=$
{
LIB
}
/root$
{
full_dest_dir
}
/`echo $file2 |
echo "Duplicating $
{
file
}
's $
{
dupdir
}
"
sed -n "s|^$
{
sym_link
}
/||p"`
echo "Duplicating $
{
sym_link
}
's $
{
dupdir
}
"
if [ -d $
{
dupdir
}
]
if [ -d $
{
dupdir
}
]
then true
then true
else
else
...
@@ -261,18 +283,20 @@ if $LINKS; then
...
@@ -261,18 +283,20 @@ if $LINKS; then
;;
;;
esac
esac
done
done
# Get the path from $
{
LIB
}
to $file, accounting for symlinks.
parent=`echo "$file" | sed -e 's@/[^/]*$@@'`
# Get the path from $
{
LIB
}
to $
{
sym_link
}
, accounting for symlinks.
#
parent=`echo "$
{
sym_link
}
" | sed -e 's@/[^/]*$@@'`
libabs=`cd $
{
LIB
}
; $
{
PWDCMD
}
`
libabs=`cd $
{
LIB
}
; $
{
PWDCMD
}
`
file2=`cd $
{
LIB
}
; cd $parent; $
{
PWDCMD
}
| sed -e "s@^$
{
libabs
}
@@"`
file2=`cd $
{
LIB
}
; cd $parent; $
{
PWDCMD
}
| sed -e "s@^$
{
libabs
}
@@"`
# DOTS is the relative path from $
{
LIB
}
/$file's dir back to $
{
LIB
}
.
# DOTS is the relative path from $
{
LIB
}
/$
{
sym_link
}
back to $
{
LIB
}
.
#
dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
rm -fr $
{
LIB
}
/$file > /dev/null 2>
&
1
rm -fr $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
ln -s $
{
dots
}
root$x $
{
LIB
}
/$file > /dev/null 2>
&
1
ln -s $
{
dots
}
root$
{
full_dest_dir
}
$
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
treetops="$treetops $x $
{
LIB
}
/root$x"
treetops="$treetops $
{
sym_link
}
$
{
LIB
}
/root$
{
full_dest_dir
}
"
fi
fi
fi
cd $cwd
fi
fi
done
done
fi
fi
...
@@ -287,6 +311,9 @@ while [ $# != 0 ]; do
...
@@ -287,6 +311,9 @@ while [ $# != 0 ]; do
#
#
SRCDIR=`cd $
{
INPUT
}
; cd $1 ; $
{
PWDCMD
}
`
SRCDIR=`cd $
{
INPUT
}
; cd $1 ; $
{
PWDCMD
}
`
export SRCDIR
export SRCDIR
FIND_BASE=$1
export FIND_BASE
shift
shift
DESTDIR=`cd $1;$
{
PWDCMD
}
`
DESTDIR=`cd $1;$
{
PWDCMD
}
`
...
@@ -302,11 +329,17 @@ while [ $# != 0 ]; do
...
@@ -302,11 +329,17 @@ while [ $# != 0 ]; do
touch $
{
DESTDIR
}
/DONE
touch $
{
DESTDIR
}
/DONE
echo Fixing directory $
{
SRCDIR
}
into $
{
DESTDIR
}
echo Fixing directory $
{
SRCDIR
}
into $
{
DESTDIR
}
# Check .h files which are symlinks as well as those which are files.
# Check files which are symlinks as well as those which are files.
# A link to a header file will not be processed by anything but this.
#
#
cd $
{
SRCDIR
}
cd $
{
INPUT
}
[=
[=_IF PROGRAM _env ! =][=
_IF PROGRAM _env ! =]
files=`if $LINKS; then
find $
{
FIND_BASE
}
/. \( -type f -o -type l \) -print
else
find $
{
FIND_BASE
}
/. -type f -print
fi | \
sed -e's;/\./;/;g' -e's;//*;/;g' `
[=
_include hackshell =][=
_include hackshell =][=
...
@@ -314,10 +347,12 @@ while [ $# != 0 ]; do
...
@@ -314,10 +347,12 @@ while [ $# != 0 ]; do
=]
=]
required="$required `if $LINKS; then
required="$required `if $LINKS; then
find
. -name '*.h'
\( -type f -o -type l \) -print
find
$
{
FIND_BASE
}
/.
\( -type f -o -type l \) -print
else
else
find . -name '*.h' -type f -print
find $
{
FIND_BASE
}
/. -type f -print
fi | $
{
FIXINCL
}
`"[=
fi | \
sed -e's;/\./;/;g' -e's;//*;/;g' | \
$
{
FIXINCL
}
`"[=
_ENDIF =]
_ENDIF =]
...
@@ -365,8 +400,8 @@ find . -name DONE -exec rm -f '{}' ';'
...
@@ -365,8 +400,8 @@ find . -name DONE -exec rm -f '{}' ';'
echo 'Removing unneeded directories:'
echo 'Removing unneeded directories:'
cd $LIB
cd $LIB
file
s=`find . -type d -print | sort -r`
all_dir
s=`find . -type d -print | sort -r`
for file in $
file
s; do
for file in $
all_dir
s; do
rmdir $LIB/$file > /dev/null 2>
&
1 | :
rmdir $LIB/$file > /dev/null 2>
&
1 | :
done
done
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment