Browse Source

OK, so an easier way to manage versions.

Debian package creation - crude, probably violated the Debian policys
but it seems to work just fine...
some other changes.
pull/62/head
Gordon Henderson 9 years ago
parent
commit
7cb817498e
13 changed files with 169 additions and 117 deletions
  1. +1
    -0
      VERSION
  2. +27
    -5
      build
  3. +10
    -0
      debian/wiringPi/DEBIAN/control
  4. +5
    -0
      debian/wiringPi/DEBIAN/postinst
  5. +2
    -0
      debian/wiringPi/DEBIAN/postrm
  6. +29
    -32
      devLib/Makefile
  7. +10
    -1
      gpio/Makefile
  8. +1
    -1
      gpio/gpio.c
  9. +26
    -0
      gpio/newVersion
  10. +1
    -0
      gpio/version.h
  11. +44
    -68
      wiringPi/Makefile
  12. +4
    -4
      wiringPi/wiringPi.c
  13. +9
    -6
      wiringPi/wpiExtensions.c

+ 1
- 0
VERSION View File

@@ -0,0 +1 @@
2.24

+ 27
- 5
build View File

@@ -73,6 +73,28 @@ if [ x$1 = "xuninstall" ]; then
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 "====================="
@@ -101,11 +123,11 @@ fi
cd wiringPi
sudo make uninstall
if [ x$1 = "xstatic" ]; then
make static
make -j5 static
check_make_ok
sudo make install-static
else
make
make -j5
check_make_ok
sudo make install
fi
@@ -116,11 +138,11 @@ fi
cd ../devLib
sudo make uninstall
if [ x$1 = "xstatic" ]; then
make static
make -j5 static
check_make_ok
sudo make install-static
else
make
make -j5
check_make_ok
sudo make install
fi
@@ -129,7 +151,7 @@ fi
echo
echo "GPIO Utility"
cd ../gpio
make
make -j5
check_make_ok
sudo make install
check_make_ok


+ 10
- 0
debian/wiringPi/DEBIAN/control View File

@@ -0,0 +1,10 @@
Package: wiringpi
Version: 2.24
Section: libraries
Priority: optional
Architecture: armhf
Depends: libc6
Maintainer: Gordon Henderson <projects@drogon.net>
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
- 0
debian/wiringPi/DEBIAN/postinst View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
/bin/chown root.root /usr/bin/gpio
/bin/chmod 4755 /usr/bin/gpio
/sbin/ldconfig

+ 2
- 0
debian/wiringPi/DEBIAN/postrm View File

@@ -0,0 +1,2 @@
#!/bin/sh
/sbin/ldconfig

+ 29
- 32
devLib/Makefile View File

@@ -1,7 +1,8 @@
#
# Makefile:
# wiringPi device - Wiring Compatable library for the Raspberry Pi
#
# Copyright (c) 2012-2013 Gordon Henderson
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# https://projects.drogon.net/raspberry-pi/wiringpi/
@@ -20,10 +21,7 @@
# along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
#################################################################################

DYN_VERS_MAJ=2
DYN_VERS_MIN=0

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

@@ -34,7 +32,8 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)
DEBUG = -O2
CC = gcc
INCLUDE = -I.
CFLAGS = $(DEBUG) -Wformat=2 -Wall $(INCLUDE) -Winline -pipe -fPIC
DEFS = -D_GNU_SOURCE
CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC

LIBS =

@@ -47,6 +46,8 @@ SRC = ds1302.c maxdetect.c piNes.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)
@@ -76,21 +77,11 @@ tags: $(SRC)
@ctags $(SRC)


.PHONY: install-headers
install-headers:
@echo "[Install Headers]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
@install -m 0644 ds1302.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 maxdetect.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 piNes.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 gertboard.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 piFace.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 lcd128x64.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 lcd.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 piGlow.h $(DESTDIR)$(PREFIX)/include

.PHONY: install
install: $(DYNAMIC) install-headers
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)
@@ -98,23 +89,29 @@ install: $(DYNAMIC) install-headers
@ldconfig

.PHONY: install-static
install-static: $(STATIC) install-headers
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
@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]"
@rm -f $(DESTDIR)$(PREFIX)/include/ds1302.h
@rm -f $(DESTDIR)$(PREFIX)/include/maxdetect.h
@rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
@rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
@rm -f $(DESTDIR)$(PREFIX)/include/piFace.h
@rm -f $(DESTDIR)$(PREFIX)/include/lcd128x64.h
@rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
@rm -f $(DESTDIR)$(PREFIX)/include/piGlow.h
@rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.*
@cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
@cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPiDev.*
@ldconfig




+ 10
- 1
gpio/Makefile View File

@@ -44,6 +44,9 @@ OBJ = $(SRC:.c=.o)

all: gpio

version.h: ../VERSION
./newVersion

gpio: $(OBJ)
@echo [Link]
@$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
@@ -63,7 +66,7 @@ tags: $(SRC)
@ctags $(SRC)

.PHONY: install
install:
install: gpio
@echo "[Install]"
@cp gpio $(DESTDIR)$(PREFIX)/bin
@chown root.root $(DESTDIR)$(PREFIX)/bin/gpio
@@ -71,6 +74,12 @@ install:
@mkdir -p $(DESTDIR)$(PREFIX)/man/man1
@cp gpio.1 $(DESTDIR)$(PREFIX)/man/man1

.PHONY: install-deb
install-deb: gpio
@echo "[Install: deb]"
@install -m 0755 -d ~/wiringPi/debian/wiringPi/usr/bin
@install -m 0755 gpio ~/wiringPi/debian/wiringPi/usr/bin

.PHONY: uninstall
uninstall:
@echo "[UnInstall]"


+ 1
- 1
gpio/gpio.c View File

@@ -40,6 +40,7 @@
#include <gertboard.h>
#include <piFace.h>

#include "version.h"

extern int wiringPiDebug ;

@@ -53,7 +54,6 @@ extern void doPins (void) ;
# define FALSE (1==2)
#endif

#define VERSION "2.23"
#define PI_USB_POWER_CONTROL 38
#define I2CDETECT "/usr/sbin/i2cdetect"



+ 26
- 0
gpio/newVersion View File

@@ -0,0 +1,26 @@
#!/bin/sh
#
# newVersion:
# Utility to create the version.h include file for the gpio command.
#
# 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/>.
#################################################################################

rm -f version.h
echo "#define VERSION \"`cat ../VERSION`\"" > version.h

+ 1
- 0
gpio/version.h View File

@@ -0,0 +1 @@
#define VERSION "2.24"

+ 44
- 68
wiringPi/Makefile View File

@@ -1,8 +1,8 @@
# ;
#
# Makefile:
# wiringPi - Wiring Compatable library for the Raspberry Pi
#
# Copyright (c) 2012 Gordon Henderson
# Copyright (c) 2012-2015 Gordon Henderson
#################################################################################
# This file is part of wiringPi:
# https://projects.drogon.net/raspberry-pi/wiringpi/
@@ -21,10 +21,7 @@
# along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
#################################################################################

DYN_VERS_MAJ=2
DYN_VERS_MIN=0

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

@@ -40,7 +37,6 @@ CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC

LIBS =

# Should not alter anything below this line
###############################################################################

SRC = wiringPi.c \
@@ -58,6 +54,21 @@ SRC = wiringPi.c \
drcSerial.c \
wpiExtensions.c

HEADERS = wiringPi.h \
wiringSerial.h wiringShift.h \
wiringPiSPI.h wiringPiI2C.h \
softPwm.h softTone.h \
mcp23008.h mcp23016.h mcp23017.h \
mcp23s08.h mcp23s17.h \
sr595.h \
pcf8574.h pcf8591.h \
mcp3002.h mcp3004.h mcp4802.h mcp3422.h \
max31855.h max5322.h \
sn3218.h \
drcSerial.h \
wpiExtensions.h


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

all: $(DYNAMIC)
@@ -78,6 +89,7 @@ $(DYNAMIC): $(OBJ)
@echo [Compile] $<
@$(CC) -c $(CFLAGS) $< -o $@


.PHONY: clean
clean:
@echo "[Clean]"
@@ -89,37 +101,11 @@ tags: $(SRC)
@ctags $(SRC)


.PHONY: install-headers
install-headers:
@echo "[Install Headers]"
@install -m 0755 -d $(DESTDIR)$(PREFIX)/include
@install -m 0644 wiringPi.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 wiringSerial.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 wiringShift.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 softPwm.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 softTone.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 wiringPiSPI.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 wiringPiI2C.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 drcSerial.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp23008.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp23016.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp23017.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp23s08.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp23s17.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 max31855.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 max5322.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp3002.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp3004.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp4802.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 mcp3422.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 sr595.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 pcf8574.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 pcf8591.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 sn3218.h $(DESTDIR)$(PREFIX)/include
@install -m 0644 wpiExtensions.h $(DESTDIR)$(PREFIX)/include

.PHONY: install
install: $(DYNAMIC) install-headers
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 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
@@ -127,39 +113,29 @@ install: $(DYNAMIC) install-headers
@ldconfig

.PHONY: install-static
install-static: $(STATIC) install-headers
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 libwiringPi.a $(DESTDIR)$(PREFIX)/lib
@install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
@install -m 0755 libwiringPi.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 libwiringPi.so.$(VERSION) ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION)
ln -sf ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION) ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so

.PHONY: uninstall
uninstall:
@echo "[UnInstall]"
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
@rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
@rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
@rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
@rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
@rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
@rm -f $(DESTDIR)$(PREFIX)/include/drcSerial.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23008.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23016.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23017.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23s08.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp23s17.h
@rm -f $(DESTDIR)$(PREFIX)/include/max31855.h
@rm -f $(DESTDIR)$(PREFIX)/include/max5322.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp3002.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp3004.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp4802.h
@rm -f $(DESTDIR)$(PREFIX)/include/mcp3422.h
@rm -f $(DESTDIR)$(PREFIX)/include/sr595.h
@rm -f $(DESTDIR)$(PREFIX)/include/pcf8574.h
@rm -f $(DESTDIR)$(PREFIX)/include/pcf8591.h
@rm -f $(DESTDIR)$(PREFIX)/include/sn3218.h
@rm -f $(DESTDIR)$(PREFIX)/includewpiExtensions.h
@rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
@cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
@cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.*
@ldconfig


@@ -195,6 +171,6 @@ max5322.o: wiringPi.h wiringPiSPI.h max5322.h
sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h
wpiExtensions.o: wiringPi.h mcp23008.h mcp23016.h mcp23017.h mcp23s08.h
wpiExtensions.o: mcp23s17.h sr595.h pcf8591.h pcf8574.h max31855.h max5322.h
wpiExtensions.o: mcp3002.h mcp3004.h mcp4802.h mcp3422.h sn3218.h drcSerial.h
wpiExtensions.o: wpiExtensions.h
wpiExtensions.o: mcp23s17.h sr595.h pcf8574.h pcf8591.h mcp3002.h mcp3004.h
wpiExtensions.o: mcp4802.h mcp3422.h max31855.h max5322.h sn3218.h
wpiExtensions.o: drcSerial.h wpiExtensions.h

+ 4
- 4
wiringPi/wiringPi.c View File

@@ -1,7 +1,7 @@
/*
* wiringPi:
* Arduino compatable (ish) Wiring library for the Raspberry Pi
* Copyright (c) 2012 Gordon Henderson
* Arduino look-a-like Wiring library for the Raspberry Pi
* Copyright (c) 2012-2015 Gordon Henderson
* Additional code for pwmSetClock by Chris Hall <chris@kchall.plus.com>
*
* Thanks to code samples from Gert Jan van Loo and the
@@ -131,7 +131,7 @@ struct wiringPiNodeStruct *wiringPiNodes = NULL ;
// Taken from Gert/Doms code. Some of this is not in the manual
// that I can find )-:

static volatile unsigned int BCM2708_PERI_BASE = 0x20000000 ;
static volatile unsigned int BCM2708_PERI_BASE = 0x20000000 ; // Variable for Pi2
#define GPIO_PADS (BCM2708_PERI_BASE + 0x00100000)
#define CLOCK_BASE (BCM2708_PERI_BASE + 0x00101000)
#define GPIO_BASE (BCM2708_PERI_BASE + 0x00200000)
@@ -607,7 +607,7 @@ int wiringPiFailure (int fatal, const char *message, ...)
*
* Revision 1 really means the early Model B's.
* Revision 2 is everything else - it covers the B, B+ and CM.
* ... and the quad core Pi 2 - which is a B+ ++ ...
* ... and the Pi 2 - which is a B+ ++ ...
*
* Seems there are some boards with 0000 in them (mistake in manufacture)
* So the distinction between boards that I can see is:


+ 9
- 6
wiringPi/wpiExtensions.c View File

@@ -44,14 +44,14 @@
#include "mcp23s08.h"
#include "mcp23s17.h"
#include "sr595.h"
#include "pcf8591.h"
#include "pcf8574.h"
#include "max31855.h"
#include "max5322.h"
#include "pcf8591.h"
#include "mcp3002.h"
#include "mcp3004.h"
#include "mcp4802.h"
#include "mcp3422.h"
#include "max31855.h"
#include "max5322.h"
#include "sn3218.h"
#include "drcSerial.h"

@@ -664,6 +664,8 @@ static struct extensionFunctionStruct extensionFunctions [] =
/*
* loadWPiExtension:
* Load in a wiringPi extension
* The extensionData always starts with the name, a colon then the pinBase
* number. Other parameters after that are decoded by the module in question.
*********************************************************************************
*/

@@ -676,7 +678,7 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)

verbose = printErrors ;

// Get the extension extension name by finding the first colon
// Get the extension name by finding the first colon

p = extension ;
while (*p != ':')
@@ -688,9 +690,10 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)
}
++p ;
}

*p++ = 0 ;

// Simple ATOI code

if (!isdigit (*p))
{
verbError ("%s: pinBase number expected after extension name", progName) ;
@@ -699,7 +702,7 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)

while (isdigit (*p))
{
if (pinBase > 1000000000)
if (pinBase > 1000000000) // Lets be realistic here...
{
verbError ("%s: pinBase too large", progName) ;
return FALSE ;


Loading…
Cancel
Save