git @ Cat's Eye Technologies shelf / b09cb67
`function` is a bash-ism - don't use it. Chris Pressey 8 years ago
1 changed file(s) with 12 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
55 ### utility functions ###
66
77
8 function _shelf_verbose() {
8 _shelf_verbose() {
99 if [ -e /tmp/.shelf_verbose ]; then
1010 echo $*
1111 fi
1212 }
1313
14 function _shelf_show_run() {
14 _shelf_show_run() {
1515 echo $*
1616 $*
1717 }
1818
19 function _shelf_ln() {
19 _shelf_ln() {
2020 source="$1"
2121 dest="$2"
2222 if [ -e "$dest" ]; then
2626 fi
2727 }
2828
29 function _shelf_link_stuff() {
29 _shelf_link_stuff() {
3030 dir="$1"
3131 subdir="$2"
3232 find_opts="-name .git -prune -o -path Funicular/eg -prune -o -path Chrysoberyl/modules -prune -o -path Chrysoberyl/checkout -prune -o $3"
4949 done
5050 }
5151
52 function _shelf_link_bin() {
52 _shelf_link_bin() {
5353 subdir="bin"
5454 find_opts="-executable -type f"
5555 skip_pat=".git|depcomp|configure|config.guess|*.h|*.so|*.so.*"
5656 _shelf_link_stuff "$1" "$subdir" "$find_opts" "$skip_pat"
5757 }
5858
59 function _shelf_link_include() {
59 _shelf_link_include() {
6060 subdir="include"
6161 find_opts="-name '*.h'"
6262 skip_pat=".git"
6363 _shelf_link_stuff "$1" "$subdir" "$find_opts" "$skip_pat"
6464 }
6565
66 function _shelf_link_lib() {
66 _shelf_link_lib() {
6767 subdir="lib"
6868 find_opts="-name '*.so' -o -name '*.so.*'"
6969 skip_pat=".git"
7474 ### public functions ###
7575
7676
77 function shelf_init() {
77 shelf_init() {
7878 export SHELF_FARM="$1"
7979 export PATH="$SHELF_FARM/bin:$PATH"
8080 export LD_LIBRARY_PATH="$SHELF_FARM/lib:$LD_LIBRARY_PATH"
8787 export LUA_CPATH="$SHELF_FARM/lib/?.so;$LUA_CPATH"
8888 }
8989
90 function shelf_link() {
90 shelf_link() {
9191 if [ "X$1" = X ]; then
9292 echo "Usage: shelf_link {dir}"
9393 return 1
102102 done
103103 }
104104
105 function shelf_unlink() {
105 shelf_unlink() {
106106 if [ "X$1" = X ]; then
107107 echo "Usage: shelf_unlink {dir}"
108108 return 1
124124 done
125125 }
126126
127 function shelf_unlink_broken() {
127 shelf_unlink_broken() {
128128 for sub in bin include lib; do
129129 for file in $SHELF_FARM/$sub/*; do
130130 if [ ! -e "$file" ]; then
134134 done
135135 }
136136
137 function shelf_build() {
137 shelf_build() {
138138 dir="$1"
139139 dir=`realpath "$dir"`
140140 if [ -x "$dir/build.sh" ]; then