Flesh out shelf_build's heuristic, based on toolshelf's.
Chris Pressey
8 years ago
13 | 13 |
Download the file `shelf.sh` and put it somewhere, say `$HOME/shelf.sh`.
|
14 | 14 |
|
15 | 15 |
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`.
|
17 | 18 |
|
18 | 19 |
Then add these four lines to the end of your shell startup script
|
19 | 20 |
(`.bashrc`, `.bash_profile`, or whatever):
|
|
54 | 55 |
* `shelf_build` *DIR*
|
55 | 56 |
|
56 | 57 |
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.
|
58 | 59 |
|
59 | 60 |
* `shelf_pwd` *NAME*
|
60 | 61 |
|
153 | 153 |
shelf_build() {
|
154 | 154 |
dir="$1"
|
155 | 155 |
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
|
159 | 162 |
./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
|
162 | 178 |
else
|
163 | 179 |
echo "No heuristic to build this source"
|
164 | 180 |
return 1
|
165 | 181 |
fi
|
|
182 |
|
|
183 |
cd $CWD
|
|
184 |
return $?
|
166 | 185 |
}
|
167 | 186 |
|
168 | 187 |
shelf_pwd() {
|