git @ Cat's Eye Technologies shelf / ffa1a40
Flesh out shelf_build's heuristic, based on toolshelf's. Chris Pressey 8 years ago
2 changed file(s) with 27 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1313 Download the file `shelf.sh` and put it somewhere, say `$HOME/shelf.sh`.
1414
1515 Or better, clone this repo as `$HOME/.shelf`; then the file `shelf.sh`
16 will be at `$HOME/.shelf/shelf.sh`, and you can pull the latest changes.
16 will be at `$HOME/.shelf/shelf.sh`, and you can pull the latest changes
17 with `cd $HOME/.shelf && git pull origin master`.
1718
1819 Then add these four lines to the end of your shell startup script
1920 (`.bashrc`, `.bash_profile`, or whatever):
5455 * `shelf_build` *DIR*
5556
5657 Make a best-effort guess at how to build the sources in *DIR*, and try to
57 build them using that method. (Not well implemented yet)
58 build them using that method.
5859
5960 * `shelf_pwd` *NAME*
6061
153153 shelf_build() {
154154 dir="$1"
155155 dir=`realpath "$dir"`
156 if [ -x "$dir/build.sh" ]; then
157 CWD=`pwd`
158 cd $dir
156
157 CWD=`pwd`
158 cd $dir
159
160 # if build command is defined for this, then run it, else
161 if [ -x "build.sh" ]; then
159162 ./build.sh
160 cd $CWD
161 return $?
163 elif [ -x "make.sh" ]; then
164 ./make.sh
165 elif [ -e "build.xml" ]; then
166 ant
167 elif [ -e "configure" ]; then
168 ./configure --prefix=$dir/install && make && make install
169 elif [ -e "configure.in" ]; then
170 autoconf && ./configure --prefix=$dir/install && make && make install
171 elif [ -e "autogen.sh" ]; then
172 ./autogen.sh && autoconf && ./configure --prefix=$dir/install && make && make install
173 elif [ -e "Makefile" ]; then
174 make
175 elif [ -e "src/Makefile" ]; then
176 cd src
177 make
162178 else
163179 echo "No heuristic to build this source"
164180 return 1
165181 fi
182
183 cd $CWD
184 return $?
166185 }
167186
168187 shelf_pwd() {