Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. #!/bin/sh -e
  2. # build
  3. # Simple wiringPi build and install script
  4. #
  5. # Copyright (c) 2012-2015 Gordon Henderson
  6. #################################################################################
  7. # This file is part of wiringPi:
  8. # A "wiring" library for the Raspberry Pi
  9. #
  10. # wiringPi is free software: you can redistribute it and/or modify
  11. # it under the terms of the GNU Lesser General Public License as published by
  12. # the Free Software Foundation, either version 3 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # wiringPi is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU Lesser General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU Lesser General Public License
  21. # along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
  22. #################################################################################
  23. #
  24. # wiringPi is designed to run on a Raspberry Pi only.
  25. # However if you're clever enough to actually look at this script to
  26. # see why it's not building for you, then good luck.
  27. #
  28. # To everyone else: Stop using cheap alternatives. Support the
  29. # Raspberry Pi Foundation as they're the only ones putting money
  30. # back into education!
  31. #################################################################################
  32. check_make_ok() {
  33. if [ $? != 0 ]; then
  34. echo ""
  35. echo "Make Failed..."
  36. echo "Please check the messages and fix any problems. If you're still stuck,"
  37. echo "then raise a GitHub issue with the output and as many details as you can"
  38. echo " https://github.com/WiringPi/WiringPi/issues"
  39. echo ""
  40. exit 1
  41. fi
  42. }
  43. sudo=${WIRINGPI_SUDO-sudo}
  44. if [ x$1 = "xclean" ]; then
  45. echo Cleaning
  46. echo
  47. cd wiringPi
  48. echo -n "wiringPi: " ; make clean
  49. cd ../devLib
  50. echo -n "DevLib: " ; make clean
  51. cd ../gpio
  52. echo -n "gpio: " ; make clean
  53. cd ../examples
  54. echo -n "Examples: " ; make clean
  55. cd Gertboard
  56. echo -n "Gertboard: " ; make clean
  57. cd ../PiFace
  58. echo -n "PiFace: " ; make clean
  59. cd ../q2w
  60. echo -n "Quick2Wire: " ; make clean
  61. cd ../PiGlow
  62. echo -n "PiGlow: " ; make clean
  63. cd ../scrollPhat
  64. echo -n "scrollPhat: " ; make clean
  65. cd ../..
  66. echo -n "Deb: " ; rm -f debian-template/wiringpi*.deb
  67. echo
  68. exit
  69. fi
  70. if [ x$1 = "xuninstall" ]; then
  71. echo Uninstalling
  72. echo
  73. echo "WiringPi library"
  74. cd wiringPi
  75. echo -n "wiringPi: " ; $sudo make uninstall
  76. cd ../devLib
  77. echo -n "DevLib: " ; $sudo make uninstall
  78. cd ../gpio
  79. echo -n "gpio: " ; $sudo make uninstall
  80. exit
  81. fi
  82. # Only if you know what you're doing!
  83. if [ x$1 = "xdebian" ]; then
  84. here=`pwd`
  85. deb_destdir=${here}/debian-template/wiringPi
  86. cd debian-template/wiringPi
  87. rm -rf usr
  88. cd $here/wiringPi
  89. make install-deb DEB_DESTDIR=${deb_destdir}
  90. cd $here/devLib
  91. make install-deb INCLUDE='-I. -I../wiringPi' DEB_DESTDIR=${deb_destdir}
  92. cd $here/gpio
  93. make install-deb INCLUDE='-I../wiringPi -I../devLib' LDFLAGS=-L../debian-template/wiringPi/usr/lib DEB_DESTDIR=${deb_destdir}
  94. cd $here/debian-template
  95. fakeroot dpkg-deb --build wiringPi
  96. mv wiringPi.deb wiringpi-`cat $here/VERSION`-1.deb
  97. exit
  98. fi
  99. if [ x$1 != "x" ]; then
  100. echo "Usage: $0 [clean | uninstall]"
  101. exit 1
  102. fi
  103. echo "wiringPi Build script"
  104. echo "====================="
  105. echo
  106. hardware=`fgrep Hardware /proc/cpuinfo | head -1 | awk '{ print $3 }'`
  107. # if [ x$hardware != "xBCM2708" ]; then
  108. # echo ""
  109. # echo " +------------------------------------------------------------+"
  110. # echo " | wiringPi is designed to run on the Raspberry Pi only. |"
  111. # echo " | This processor does not appear to be a Raspberry Pi. |"
  112. # echo " +------------------------------------------------------------+"
  113. # echo " | In the unlikely event that you think it is a Raspberry Pi, |"
  114. # echo " | then please accept my apologies and email the contents of |"
  115. # echo " | /proc/cpuinfo to projects@drogon.net. |"
  116. # echo " | - Thanks, Gordon |"
  117. # echo " +------------------------------------------------------------+"
  118. # echo ""
  119. # exit 1
  120. # fi
  121. echo
  122. echo "WiringPi Library"
  123. cd wiringPi
  124. $sudo make uninstall
  125. if [ x$1 = "xstatic" ]; then
  126. make -j5 static
  127. check_make_ok
  128. $sudo make install-static
  129. else
  130. make -j5
  131. check_make_ok
  132. $sudo make install
  133. fi
  134. check_make_ok
  135. echo
  136. echo "WiringPi Devices Library"
  137. cd ../devLib
  138. $sudo make uninstall
  139. if [ x$1 = "xstatic" ]; then
  140. make -j5 static
  141. check_make_ok
  142. $sudo make install-static
  143. else
  144. make -j5
  145. check_make_ok
  146. $sudo make install
  147. fi
  148. check_make_ok
  149. echo
  150. echo "GPIO Utility"
  151. cd ../gpio
  152. make -j5
  153. check_make_ok
  154. $sudo make install
  155. check_make_ok
  156. # echo
  157. # echo "wiringPi Daemon"
  158. # cd ../wiringPiD
  159. # make -j5
  160. # check_make_ok
  161. # $sudo make install
  162. # check_make_ok
  163. # echo
  164. # echo "Examples"
  165. # cd ../examples
  166. # make
  167. # cd ..
  168. echo
  169. echo All Done.
  170. echo ""
  171. echo "NOTE: To compile programs with wiringPi, you need to add:"
  172. echo " -lwiringPi"
  173. echo " to your compile line(s) To use the Gertboard, MaxDetect, etc."
  174. echo " code (the devLib), you need to also add:"
  175. echo " -lwiringPiDev"
  176. echo " to your compile line(s)."
  177. echo ""