##// END OF EJS Templates
sync
jeandet -
r135:0c6f64b8ccc5 alexis
parent child
Show More
@@ -0,0 +1,82
1 #!/bin/bash
2 #"======================================================================================="
3 #"---------------------------------------------------------------------------------------"
4 #" LPP VHDL lib makeDirs "
5 #" Copyright (C) 2010 Laboratory of Plasmas Physic. "
6 #"======================================================================================="
7 #----------------------------------------------------------------------------------------
8 # This file is a part of the LPP VHDL IP LIBRARY
9 # Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS
10 #
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #----------------------------------------------------------------------------------------
25
26
27
28 # Full path function
29 function fullpath() {
30 if test $# -gt 0
31 then
32 cd $1
33 echo `pwd`
34 fi
35 }
36
37
38
39 # Relative path function
40 # both $1 and $2 are absolute paths (biginning with /)
41 # returns $2 relative to $1
42 function relpath() {
43 if test $# -gt 1
44 then
45 source=`fullpath $1`
46 target=`fullpath $2`
47
48 common_part=$source # for now
49 result="" # for now
50
51 while [[ "${target#$common_part}" == "${target}" ]]; do
52 # no match, means that candidate common part is not correct
53 # go up one level (reduce common part)
54 common_part="$(dirname $common_part)"
55 # and record that we went back, with correct / handling
56 if [[ -z $result ]]; then
57 result=".."
58 else
59 result="../$result"
60 fi
61 done
62
63 if [[ $common_part == "/" ]]; then
64 # special case for root (no common path)
65 result="$result/"
66 fi
67
68 # since we now have identified the common part,
69 # compute the non-common part
70 forward_part="${target#$common_part}"
71
72 # and now stick all parts together
73 if [[ -n $result ]] && [[ -n $forward_part ]]; then
74 result="$result$forward_part"
75 elif [[ -n $forward_part ]]; then
76 # extra slash removal
77 result="${forward_part:1}"
78 fi
79
80 echo $result
81 fi
82 }
@@ -1,71 +1,68
1 echo "======================================================================================="
1 echo "======================================================================================="
2 echo "---------------------------------------------------------------------------------------"
2 echo "---------------------------------------------------------------------------------------"
3 echo " LPP's GRLIB GLOBAL PATCHER "
3 echo " LPP's GRLIB GLOBAL PATCHER "
4 echo " Copyright (C) 2013 Laboratory of Plasmas Physic. "
4 echo " Copyright (C) 2013 Laboratory of Plasmas Physic. "
5 echo "======================================================================================="
5 echo "======================================================================================="
6 echo '------------------------------------------------------------------------------
6 echo '------------------------------------------------------------------------------
7 -- This file is a part of the LPP VHDL IP LIBRARY
7 -- This file is a part of the LPP VHDL IP LIBRARY
8 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
8 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
9 --
9 --
10 -- This program is free software; you can redistribute it and/or modify
10 -- This program is free software; you can redistribute it and/or modify
11 -- it under the terms of the GNU General Public License as published by
11 -- it under the terms of the GNU General Public License as published by
12 -- the Free Software Foundation; either version 3 of the License, or
12 -- the Free Software Foundation; either version 3 of the License, or
13 -- (at your option) any later version.
13 -- (at your option) any later version.
14 --
14 --
15 -- This program is distributed in the hope that it will be useful,
15 -- This program is distributed in the hope that it will be useful,
16 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
16 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
17 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 -- GNU General Public License for more details.
18 -- GNU General Public License for more details.
19 --
19 --
20 -- You should have received a copy of the GNU General Public License
20 -- You should have received a copy of the GNU General Public License
21 -- along with this program; if not, write to the Free Software
21 -- along with this program; if not, write to the Free Software
22 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 -------------------------------------------------------------------------------'
23 -------------------------------------------------------------------------------'
24 echo
24 echo
25 echo
25 echo
26 echo
26 echo
27
27
28 # Absolute path to this script. /home/user/bin/foo.sh
29 #SCRIPT=$(readlink -f $0)
30 # Absolute path this script is in. /home/user/bin
31
28
32 #LPP_PATCHPATH=`dirname $SCRIPT`
29 VHDLIB_LIB_PATH=`pwd -L`
33 LPP_PATCHPATH=`pwd -L`
30 source $VHDLIB_LIB_PATH/scripts/lpp_bash_functions.sh
34
35 GRLIBPATH=$1
31 GRLIBPATH=$1
36
32
37 echo $LPP_PATCHPATH
38 if [ -d "$GRLIBPATH" ]; then
33 if [ -d "$GRLIBPATH" ]; then
34 LPP_PATCHPATH=`relpath $GRLIBPATH $VHDLIB_LIB_PATH`
35 echo $LPP_PATCHPATH
39 if [ -d "$GRLIBPATH/lib" ]; then
36 if [ -d "$GRLIBPATH/lib" ]; then
40 if [ -d "$GRLIBPATH/designs" ]; then
37 if [ -d "$GRLIBPATH/designs" ]; then
41 if [ -d "$GRLIBPATH/boards" ]; then
38 if [ -d "$GRLIBPATH/boards" ]; then
42
39
43 echo "Patch $1/lib/libs.txt..."
40 echo "Patch $1/lib/libs.txt..."
44 if(grep -q $LPP_PATCHPATH/lib/lpp $1/lib/libs.txt); then
41 if(grep -q $LPP_PATCHPATH/lib/lpp $1/lib/libs.txt); then
45 echo "No need to Patch $1/lib/libs.txt..."
42 echo "No need to Patch $1/lib/libs.txt..."
46 else
43 else
47 echo $LPP_PATCHPATH/lib/lpp >>$1/lib/libs.txt
44 echo $LPP_PATCHPATH/lib/lpp >>$1/lib/libs.txt
48 fi
45 fi
49 echo
46 echo
50 echo
47 echo
51 echo
48 echo
52 else
49 else
53 echo "I can't find GRLIB in $1"
50 echo "I can't find GRLIB in $1"
54 fi
51 fi
55
52
56 else
53 else
57 echo "I can't find GRLIB in $1"
54 echo "I can't find GRLIB in $1"
58 fi
55 fi
59 else
56 else
60 echo "I can't find GRLIB in $1"
57 echo "I can't find GRLIB in $1"
61 fi
58 fi
62
59
63 else
60 else
64 echo "I can't find GRLIB in $1"
61 echo "I can't find GRLIB in $1"
65 fi
62 fi
66
63
67
64
68
65
69
66
70
67
71
68
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now