Browse Source

Add pkg-config configuration

pull/295/head
Jonah Janzen 1 week ago
parent
commit
b55174b750
No known key found for this signature in database GPG Key ID: 66814C69F7505763
3 changed files with 39 additions and 13 deletions
  1. +1
    -0
      .gitignore
  2. +27
    -13
      wiringPi/Makefile
  3. +11
    -0
      wiringPi/wiringPi.pc.in

+ 1
- 0
.gitignore View File

@@ -5,3 +5,4 @@ lib*.so.*
debian-template/wiringPi debian-template/wiringPi
debian-template/wiringpi-*.deb debian-template/wiringpi-*.deb
gpio/gpio gpio/gpio
wiringPi/wiringPi.pc

+ 27
- 13
wiringPi/Makefile View File

@@ -24,6 +24,9 @@
VERSION=$(shell cat ../VERSION) VERSION=$(shell cat ../VERSION)
DESTDIR?=/usr DESTDIR?=/usr
PREFIX?=/local PREFIX?=/local
LIBDIR=$(DESTDIR)$(PREFIX)/lib
INCLUDEDIR=$(DESTDIR)$(PREFIX)/include
PKGCONFIGDIR = /usr/share/pkgconfig


LDCONFIG?=ldconfig LDCONFIG?=ldconfig


@@ -93,17 +96,25 @@ tags: $(SRC)
$Q echo [ctags] $Q echo [ctags]
$Q ctags $(SRC) $Q ctags $(SRC)


wiringPi.pc: wiringPi.pc.in
sed -e 's|@prefix@|$(DESTDIR)$(PREFIX)|g' \
-e 's|@libdir@|$(LIBDIR)|g' \
-e 's|@includedir@|$(INCLUDEDIR)|g' \
-e 's|@VERSION@|$(VERSION)|g' \
$< > $@


.PHONY: install .PHONY: install
install: $(DYNAMIC)
install: $(DYNAMIC) wiringPi.pc
$Q echo "[Install Headers]" $Q echo "[Install Headers]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include
$Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include
$Q install -m 0755 -d $(INCLUDEDIR)
$Q install -m 0644 $(HEADERS) $(INCLUDEDIR)
$Q echo "[Install Dynamic Lib]" $Q echo "[Install Dynamic Lib]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
$Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
$Q install -m 0755 -d $(LIBDIR)
$Q install -m 0755 libwiringPi.so.$(VERSION) $(LIBDIR)/libwiringPi.so.$(VERSION)
$Q ln -sf $(LIBDIR)/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
$Q $(LDCONFIG) $Q $(LDCONFIG)
$Q echo "[Install pkg-config configuration]"
$Q install -m 0644 wiringPi.pc $(PKGCONFIGDIR)/wiringPi.pc


.PHONY: check-deb-destdir .PHONY: check-deb-destdir
check-deb-destdir: check-deb-destdir:
@@ -112,23 +123,26 @@ ifndef DEB_DESTDIR
endif endif


.PHONY: install-deb .PHONY: install-deb
install-deb: $(DYNAMIC) check-deb-destdir
install-deb: $(DYNAMIC) check-deb-destdir wiringPi.pc
$Q echo "[Install Headers: deb]" $Q echo "[Install Headers: deb]"
$Q install -m 0755 -d $(DEB_DESTDIR)/usr/include
$Q install -m 0644 $(HEADERS) $(DEB_DESTDIR)/usr/include
$Q install -m 0755 -d $(DEB_DESTDIR)/usr/include
$Q install -m 0644 $(HEADERS) $(DEB_DESTDIR)/usr/include
$Q echo "[Install Dynamic Lib: deb]" $Q echo "[Install Dynamic Lib: deb]"
install -m 0755 -d $(DEB_DESTDIR)/usr/lib
install -m 0755 -d $(DEB_DESTDIR)/usr/lib
install -m 0755 libwiringPi.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPi.so.$(VERSION) install -m 0755 libwiringPi.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPi.so.$(VERSION)
ln -sf $(DEB_DESTDIR)/usr/lib/libwiringPi.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPi.so ln -sf $(DEB_DESTDIR)/usr/lib/libwiringPi.so.$(VERSION) $(DEB_DESTDIR)/usr/lib/libwiringPi.so
$Q echo "[Install pkg-config configuration: deb]"
$Q install -m 0755 -d $(DEB_DESTDIR)$(PKGCONFIGDIR)
$Q install -m 0644 wiringPi.pc $(DEB_DESTDIR)$(PKGCONFIGDIR)/wiringPi.pc


.PHONY: uninstall .PHONY: uninstall
uninstall: uninstall:
$Q echo "[UnInstall]" $Q echo "[UnInstall]"
$Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
$Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.*
$Q cd $(INCLUDEDIR) && rm -f $(HEADERS)
$Q cd $(LIBDIR) && rm -f libwiringPi.*
$Q cd $(PKGCONFIGDIR) && rm -f wiringPi.pc
$Q $(LDCONFIG) $Q $(LDCONFIG)



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


+ 11
- 0
wiringPi/wiringPi.pc.in View File

@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=${prefix}
libdir=@libdir@
includedir=@includedir@

Name: WiringPi
Description: The arguably fastest GPIO Library for the Raspberry Pi
Version: @VERSION@

Libs: -L${libdir} -lwiringPi
Cflags: -I${includedir}

Loading…
Cancel
Save