Skip to content

Commit

Permalink
Pi 2 compatibility update
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Mar 26, 2015
1 parent 8f8f837 commit 73e90d8
Show file tree
Hide file tree
Showing 116 changed files with 8,564 additions and 3,206 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.gem
test.rb
ext/wiringpi/WiringPi/build/
ext/wiringpi/WiringPi/examples/
12 changes: 0 additions & 12 deletions ext/wiringpi/WiringPi/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ To un-install wiringPi:

./build uninstall


I2C:

If your system has the correct i2c-dev libraries and headers installed,
then the I2C helpers will be compiled into wiringPi. If you want to
use the I2C helpers and don't have them installed, then under Raspbian,
issue the command:

sudo apt-get install libi2c-dev

Consult the documentation for your system if you are not running Raspbian.

Gordon Henderson

[email protected]
Expand Down
6 changes: 6 additions & 0 deletions ext/wiringpi/WiringPi/People
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ CHARLES Thibaut:

Xian Stannard
Fixing some typos in the man page!

Andre Crone
Suggested the __WIRING_PI.H__ round wiringPi.h

Rik Teerling
Pointing out some silly mistooks in the I2C code...
2 changes: 1 addition & 1 deletion ext/wiringpi/WiringPi/README.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ accepted to Github....

Please see

https://projects.drogon.net/raspberry-pi/wiringpi/
http://wiringpi.com/

for the official documentation, etc. and the best way to submit bug reports, etc.
is by sending an email to [email protected]
Expand Down
1 change: 1 addition & 0 deletions ext/wiringpi/WiringPi/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.25
151 changes: 127 additions & 24 deletions ext/wiringpi/WiringPi/build
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
#!/bin/bash
#!/bin/sh

check-make-ok()
{
# build
# Simple wiringPi build and install script
#
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# Wiring Compatable library for the Raspberry Pi
#
# wiringPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# wiringPi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
#################################################################################
#
# wiringPi is designed to run on a Raspberry Pi only.
# However if you're clever enough to actually look at this script to
# see why it's not building for you, then good luck.
#
# To everyone else: Stop using cheap alternatives. Support the
# Raspberry Pi Foundation as they're the only ones putting money
# back into education!
#################################################################################

check_make_ok() {
if [ $? != 0 ]; then
echo ""
echo "Make Failed..."
Expand All @@ -14,52 +44,117 @@ check-make-ok()
}

if [ x$1 = "xclean" ]; then
echo Cleaning
echo
cd wiringPi
make clean
echo -n "wiringPi: " ; make clean
cd ../devLib
echo -n "DevLib: " ; make clean
cd ../gpio
make clean
echo -n "gpio: " ; make clean
cd ../examples
make clean
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
exit
fi

if [ x$1 = "xuninstall" ]; then
echo Uninstalling
echo
echo "WiringPi library"
cd wiringPi
sudo make uninstall
echo
echo "GPIO Utility"
echo -n "wiringPi: " ; sudo make uninstall
cd ../devLib
echo -n "DevLib: " ; sudo make uninstall
cd ../gpio
sudo make uninstall
cd ..
echo -n "gpio: " ; sudo make uninstall
exit
fi

# Only if you know what you're doing!

if [ x$1 = "xdebian" ]; then
here=`pwd`
cd debian/wiringPi
rm -rf usr
cd $here/wiringPi
make install-deb
cd $here/devLib
make install-deb
cd $here/gpio
make install-deb
cd $here/debian
fakeroot dpkg-deb --build wiringPi
mv wiringPi.deb wiringpi-`cat $here/VERSION`-1.deb
exit
fi

if [ x$1 != "x" ]; then
echo "Usage: $0 [clean | uninstall]"
exit 1
fi

echo "wiringPi Build script"
echo "====================="
echo

hardware=`fgrep Hardware /proc/cpuinfo | head -1 | awk '{ print $3 }'`

# 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 [email protected]. |"
# echo " | - Thanks, Gordon |"
# echo " +------------------------------------------------------------+"
# echo ""
# exit 1
# fi


echo
echo "WiringPi library"
echo "WiringPi Library"
cd wiringPi
sudo make uninstall
make
check-make-ok
sudo make install
check-make-ok
if [ x$1 = "xstatic" ]; then
make -j5 static
check_make_ok
sudo make install-static
else
make -j5
check_make_ok
sudo make install
fi
check_make_ok

echo
echo "WiringPi Devices Library"
cd ../devLib
sudo make uninstall
if [ x$1 = "xstatic" ]; then
make -j5 static
check_make_ok
sudo make install-static
else
make -j5
check_make_ok
sudo make install
fi
check_make_ok

echo
echo "GPIO Utility"
cd ../gpio
make
check-make-ok
make -j5
check_make_ok
sudo make install
check-make-ok
check_make_ok

# echo
# echo "Examples"
Expand All @@ -69,3 +164,11 @@ fi

echo
echo All Done.
echo ""
echo "NOTE: To compile programs with wiringPi, you need to add:"
echo " -lwiringPi"
echo " to your compile line(s) To use the Gertboard, MaxDetect, etc."
echo " code (the devLib), you need to also add:"
echo " -lwiringPiDev"
echo " to your compile line(s)."
echo ""
10 changes: 10 additions & 0 deletions ext/wiringpi/WiringPi/debian/wiringPi/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: wiringpi
Version: 2.24
Section: libraries
Priority: optional
Architecture: armhf
Depends: libc6
Maintainer: Gordon Henderson <[email protected]>
Description: The wiringPi libraries, headers and gpio command
Libraries to allow GPIO access on a Raspberry Pi from C and C++
programs as well as from the command-line
5 changes: 5 additions & 0 deletions ext/wiringpi/WiringPi/debian/wiringPi/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e
/bin/chown root.root /usr/bin/gpio
/bin/chmod 4755 /usr/bin/gpio
/sbin/ldconfig
2 changes: 2 additions & 0 deletions ext/wiringpi/WiringPi/debian/wiringPi/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
/sbin/ldconfig
131 changes: 131 additions & 0 deletions ext/wiringpi/WiringPi/devLib/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#
# Makefile:
# wiringPi device - Wiring Compatable library for the Raspberry Pi
#
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# https://projects.drogon.net/raspberry-pi/wiringpi/
#
# wiringPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# wiringPi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
#################################################################################

VERSION=$(shell cat ../VERSION)
DESTDIR=/usr
PREFIX=/local

STATIC=libwiringPiDev.a
DYNAMIC=libwiringPiDev.so.$(VERSION)

#DEBUG = -g -O0
DEBUG = -O2
CC = gcc
INCLUDE = -I.
DEFS = -D_GNU_SOURCE
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC

LIBS =

###############################################################################

SRC = ds1302.c maxdetect.c piNes.c \
gertboard.c piFace.c \
lcd128x64.c lcd.c \
piGlow.c

OBJ = $(SRC:.c=.o)

HEADERS = ds1302.h gertboard.h lcd128x64.h lcd.h maxdetect.h piFace.h piGlow.h piNes.h

all: $(DYNAMIC)

static: $(STATIC)

$(STATIC): $(OBJ)
@echo "[Link (Static)]"
@ar rcs $(STATIC) $(OBJ)
@ranlib $(STATIC)
# @size $(STATIC)

$(DYNAMIC): $(OBJ)
@echo "[Link (Dynamic)]"
@$(CC) -shared -Wl,-soname,libwiringPiDev.so -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)

.c.o:
@echo [Compile] $<
@$(CC) -c $(CFLAGS) $< -o $@

.PHONY: clean
clean:
@echo "[Clean]"
@rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.*

.PHONY: tags
tags: $(SRC)
@echo [ctags]
@ctags $(SRC)


.PHONY: install
install: $(DYNAMIC)
@echo "[Install Headers]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
@install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
@echo "[Install Dynamic Lib]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
@install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
@ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
@ldconfig

.PHONY: install-static
install-static: $(STATIC)
@echo "[Install Headers]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
@install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
@echo "[Install Static Lib]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
@install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib

.PHONY: install-deb
install-deb: $(DYNAMIC)
@echo "[Install Headers: deb]"
@install -m 0755 -d ~/wiringPi/debian/wiringPi/usr/include
@install -m 0644 $(HEADERS) ~/wiringPi/debian/wiringPi/usr/include
@echo "[Install Dynamic Lib: deb]"
install -m 0755 -d ~/wiringPi/debian/wiringPi/usr/lib
install -m 0755 libwiringPiDev.so.$(VERSION) ~/wiringPi/debian/wiringPi/usr/lib/libwiringPiDev.so.$(VERSION)
ln -sf ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION) ~/wiringPi/debian/wiringPi/usr/lib/libwiringPiDev.so

.PHONY: uninstall
uninstall:
@echo "[UnInstall]"
@cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
@cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPiDev.*
@ldconfig


.PHONY: depend
depend:
makedepend -Y $(SRC)

# DO NOT DELETE

ds1302.o: ds1302.h
maxdetect.o: maxdetect.h
piNes.o: piNes.h
gertboard.o: gertboard.h
piFace.o: piFace.h
lcd128x64.o: font.h lcd128x64.h
lcd.o: lcd.h
piGlow.o: piGlow.h
Loading

0 comments on commit 73e90d8

Please sign in to comment.