build: Clean up build script and do uninstall/clean before install
This because to make sure removing legacy files that could occurs library conflicts. Signed-off-by: Yang Deokgyu <secugyu@gmail.com> Change-Id: Id795969241ba925104d374b99b496c799b9ed1df
This commit is contained in:
173
build
173
build
@@ -31,6 +31,13 @@
|
|||||||
# back into education!
|
# back into education!
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
sudo=${WIRINGPI_SUDO-sudo}
|
||||||
|
make="make -j $(( $(nproc) + 1 ))"
|
||||||
|
hardware=$(fgrep -a Hardware /proc/cpuinfo | head -1 | awk '{ printf("%s %s %s\n", $3, $4, $5) }' | xargs)
|
||||||
|
[ "$hardware",, != *"odroid"* ] \
|
||||||
|
&& [ -f "/sys/firmware/devicetree/base/model" ] \
|
||||||
|
&& hardware=$(cat /sys/firmware/devicetree/base/model)
|
||||||
|
|
||||||
check_make_ok() {
|
check_make_ok() {
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
@@ -74,92 +81,11 @@ configure_gpiomem() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
sudo=${WIRINGPI_SUDO-sudo}
|
install() {
|
||||||
make="make -j $(( $(nproc) + 1 ))"
|
|
||||||
hardware=$(fgrep -a Hardware /proc/cpuinfo | head -1 | awk '{ printf("%s %s %s\n", $3, $4, $5) }' | xargs)
|
|
||||||
[ "$hardware",, != *"odroid"* ] \
|
|
||||||
&& [ -f "/sys/firmware/devicetree/base/model" ] \
|
|
||||||
&& hardware=$(cat /sys/firmware/devicetree/base/model)
|
|
||||||
|
|
||||||
if [ x$1 = "xclean" ]; then
|
|
||||||
cd wiringPi
|
|
||||||
echo -n "wiringPi: " ; $make clean
|
|
||||||
cd ../devLib
|
|
||||||
echo -n "DevLib: " ; $make clean
|
|
||||||
cd ../gpio
|
|
||||||
echo -n "gpio: " ; $make clean
|
|
||||||
cd ../examples
|
|
||||||
echo -n "Examples: " ; $make clean
|
|
||||||
cd Gertboard
|
|
||||||
echo -n "Gertboard: " ; $make clean
|
|
||||||
cd ../PiFace
|
|
||||||
echo -n "PiFace: " ; $make clean
|
|
||||||
cd ../q2w
|
|
||||||
echo -n "Quick2Wire: " ; $make clean
|
|
||||||
cd ../PiGlow
|
|
||||||
echo -n "PiGlow: " ; $make clean
|
|
||||||
cd ../scrollPhat
|
|
||||||
echo -n "scrollPhat: " ; $make clean
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x$1 = "xuninstall" ]; then
|
|
||||||
cd wiringPi
|
|
||||||
echo -n "wiringPi: " ; $sudo $make uninstall
|
|
||||||
cd ../devLib
|
|
||||||
echo -n "DevLib: " ; $sudo $make uninstall
|
|
||||||
cd ../gpio
|
|
||||||
echo -n "gpio: " ; $sudo $make uninstall
|
|
||||||
cd ..
|
|
||||||
echo -n "Deconfigure /dev/gpiomem" ; configure_gpiomem uninstall
|
|
||||||
echo
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Only if you know what you're doing!
|
|
||||||
|
|
||||||
if [ x$1 = "xdebian" ]; then
|
|
||||||
here=`pwd`
|
|
||||||
cd debian-template/wiringPi
|
|
||||||
rm -rf usr
|
|
||||||
cd $here/wiringPi
|
|
||||||
$make install-deb
|
|
||||||
cd $here/devLib
|
|
||||||
$make install-deb INCLUDE='-I. -I../wiringPi'
|
|
||||||
cd $here/gpio
|
|
||||||
$make install-deb INCLUDE='-I../wiringPi -I../devLib' LDFLAGS=-L../debian-template/wiringPi/usr/lib
|
|
||||||
cd $here/debian-template
|
|
||||||
fakeroot dpkg-deb --build wiringPi
|
|
||||||
mv wiringPi.deb odroid-wiringpi-`cat $here/VERSION`.deb
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x$1 != "x" ]; then
|
|
||||||
echo "Usage: $0 [clean | uninstall]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "wiringPi Build script"
|
echo "wiringPi Build script"
|
||||||
echo "====================="
|
echo "====================="
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
||||||
# if [ x$hardware != "xBCM2708" ]; then
|
|
||||||
# echo ""
|
|
||||||
# echo " +------------------------------------------------------------+"
|
|
||||||
# echo " | wiringPi is designed to run on the Raspberry Pi only. |"
|
|
||||||
# echo " | This processor does not appear to be a Raspberry Pi. |"
|
|
||||||
# echo " +------------------------------------------------------------+"
|
|
||||||
# echo " | In the unlikely event that you think it is a Raspberry Pi, |"
|
|
||||||
# echo " | then please accept my apologies and email the contents of |"
|
|
||||||
# echo " | /proc/cpuinfo to projects@drogon.net. |"
|
|
||||||
# echo " | - Thanks, Gordon |"
|
|
||||||
# echo " +------------------------------------------------------------+"
|
|
||||||
# echo ""
|
|
||||||
# exit 1
|
|
||||||
# fi
|
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "WiringPi Library"
|
echo "WiringPi Library"
|
||||||
cd wiringPi
|
cd wiringPi
|
||||||
@@ -203,20 +129,6 @@ fi
|
|||||||
cd ..
|
cd ..
|
||||||
configure_gpiomem
|
configure_gpiomem
|
||||||
|
|
||||||
# echo
|
|
||||||
# echo "wiringPi Daemon"
|
|
||||||
# cd ../wiringPiD
|
|
||||||
# make
|
|
||||||
# check_make_ok
|
|
||||||
# $sudo $make install
|
|
||||||
# check_make_ok
|
|
||||||
|
|
||||||
# echo
|
|
||||||
# echo "Examples"
|
|
||||||
# cd ../examples
|
|
||||||
# make
|
|
||||||
# cd ..
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo All Done.
|
echo All Done.
|
||||||
echo ""
|
echo ""
|
||||||
@@ -227,3 +139,72 @@ echo " code (the devLib), you need to also add:"
|
|||||||
echo " -lwiringPiDev"
|
echo " -lwiringPiDev"
|
||||||
echo " to your compile line(s)."
|
echo " to your compile line(s)."
|
||||||
echo ""
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstall() {
|
||||||
|
cd wiringPi
|
||||||
|
echo -n "wiringPi: " ; $sudo $make uninstall
|
||||||
|
cd ../devLib
|
||||||
|
echo -n "DevLib: " ; $sudo $make uninstall
|
||||||
|
cd ../gpio
|
||||||
|
echo -n "gpio: " ; $sudo $make uninstall
|
||||||
|
cd ..
|
||||||
|
echo -n "Deconfigure /dev/gpiomem" ; configure_gpiomem uninstall
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
clean() {
|
||||||
|
cd wiringPi
|
||||||
|
echo -n "wiringPi: " ; $make clean
|
||||||
|
cd ../devLib
|
||||||
|
echo -n "DevLib: " ; $make clean
|
||||||
|
cd ../gpio
|
||||||
|
echo -n "gpio: " ; $make clean
|
||||||
|
cd ../examples
|
||||||
|
echo -n "Examples: " ; $make clean
|
||||||
|
cd Gertboard
|
||||||
|
echo -n "Gertboard: " ; $make clean
|
||||||
|
cd ../PiFace
|
||||||
|
echo -n "PiFace: " ; $make clean
|
||||||
|
cd ../q2w
|
||||||
|
echo -n "Quick2Wire: " ; $make clean
|
||||||
|
cd ../PiGlow
|
||||||
|
echo -n "PiGlow: " ; $make clean
|
||||||
|
cd ../scrollPhat
|
||||||
|
echo -n "scrollPhat: " ; $make clean
|
||||||
|
cd ../..
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ x$1 = "xclean" ]; then
|
||||||
|
clean
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x$1 = "xuninstall" ]; then
|
||||||
|
uninstall
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only if you know what you're doing!
|
||||||
|
if [ x$1 = "xdebian" ]; then
|
||||||
|
here=`pwd`
|
||||||
|
cd debian-template/wiringPi
|
||||||
|
rm -rf usr
|
||||||
|
cd $here/wiringPi
|
||||||
|
$make install-deb
|
||||||
|
cd $here/devLib
|
||||||
|
$make install-deb INCLUDE='-I. -I../wiringPi'
|
||||||
|
cd $here/gpio
|
||||||
|
$make install-deb INCLUDE='-I../wiringPi -I../devLib' LDFLAGS=-L../debian-template/wiringPi/usr/lib
|
||||||
|
cd $here/debian-template
|
||||||
|
fakeroot dpkg-deb --build wiringPi
|
||||||
|
mv wiringPi.deb odroid-wiringpi-`cat $here/VERSION`.deb
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x$1 != "x" ]; then
|
||||||
|
echo "Usage: $0 [clean | uninstall]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
uninstall; clean; install
|
||||||
|
|||||||
Reference in New Issue
Block a user