script improvements

This commit is contained in:
Dick Hollenbeck 2013-10-24 08:57:01 -05:00
parent 1731e89508
commit 75f2e5446e
1 changed files with 36 additions and 11 deletions

View File

@ -8,7 +8,7 @@
# that step for other linux distros. # that step for other linux distros.
# Set where the 3 source trees will go # Set where the 3 source trees will go, use a full path
WORKING_TREES=~/kicad_sources WORKING_TREES=~/kicad_sources
@ -76,6 +76,15 @@ install_prerequisites()
} }
rm_build_dir()
{
local dir="$1"
# this file is often created as root, so remove as root
sudo rm "$dir/install_manifest.txt" 2> /dev/null
rm -rf "$dir"
}
install_or_update() install_or_update()
{ {
echo "step 1) installing pre-requisites" echo "step 1) installing pre-requisites"
@ -106,11 +115,11 @@ install_or_update()
echo "step 4) checking out the libraries from launchpad repo..." echo "step 4) checking out the libraries from launchpad repo..."
if [ ! -d "$WORKING_TREES/kicad-lib.bzr" ]; then if [ ! -d "$WORKING_TREES/kicad-lib.bzr" ]; then
bzr checkout lp:~kicad-lib-committers/kicad/library kicad-lib.bzr bzr checkout lp:~kicad-lib-committers/kicad/library kicad-lib.bzr
echo ' kicad-lib just checked out.' echo ' kicad-lib checked out.'
else else
cd kicad-lib.bzr cd kicad-lib.bzr
bzr up bzr up
echo ' kicad-lib repo just updated.' echo ' kicad-lib repo updated.'
cd ../ cd ../
fi fi
@ -128,12 +137,20 @@ install_or_update()
echo "step 6) compiling source code..." echo "step 6) compiling source code..."
cd kicad.bzr cd kicad.bzr
rm -rf build && mkdir build && cd build if [ ! -d "build" ]; then
cmake -DCMAKE_BUILD_TYPE=Release \ mkdir build && cd build
-DUSE_FP_LIB_TABLE=ON \ cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_GITHUB_PLUGIN=ON \ -DUSE_FP_LIB_TABLE=ON \
../ -DBUILD_GITHUB_PLUGIN=ON \
make ../
else
cd build
# Although a "make clean" is sometimes needed, more often than not it slows down the update
# more than it is worth. Do it manually if you need to in this directory.
# make clean
fi
make -j4
echo " kicad compiled." echo " kicad compiled."
@ -150,7 +167,8 @@ install_or_update()
echo "step 9) installing libraries..." echo "step 9) installing libraries..."
cd ../../kicad-lib.bzr cd ../../kicad-lib.bzr
rm -rf build && mkdir build && cd build rm_build_dir build
mkdir build && cd build
cmake ../ cmake ../
sudo make install sudo make install
echo " kicad-lib installed." echo " kicad-lib installed."
@ -158,16 +176,23 @@ install_or_update()
echo "step 10) installing documentation..." echo "step 10) installing documentation..."
cd ../../kicad-doc.bzr cd ../../kicad-doc.bzr
rm -rf build && mkdir build && cd build rm_build_dir build
mkdir build && cd build
cmake ../ cmake ../
sudo make install sudo make install
echo " kicad-doc.bzr installed." echo " kicad-doc.bzr installed."
echo
echo 'All KiCad "--install-or-update" steps completed, you are up to date.'
} }
if [ $# -eq 1 -a "$1" == "--remove-sources" ]; then if [ $# -eq 1 -a "$1" == "--remove-sources" ]; then
# run this only once, kills .config & makes dirs # run this only once, kills .config & makes dirs
echo "deleting $WORKING_TREES" echo "deleting $WORKING_TREES"
rm_build_dir "$WORKING_TREES/kicad.bzr/build"
rm_build_dir "$WORKING_TREES/kicad-lib.bzr/build"
rm_build_dir "$WORKING_TREES/kicad-doc.bzr/build"
rm -rf "$WORKING_TREES" rm -rf "$WORKING_TREES"
exit exit
fi fi