Skip to content

Commit

Permalink
generate and install a pkgconfig file on make install (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim Repomaa authored Feb 13, 2021
1 parent e2057b4 commit d57fc02
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.o
*.so*
*.1
libxdo.pc
xdo_version.h
xdotool
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ INSTALLBIN?=$(PREFIX)/bin
INSTALLLIB?=$(PREFIX)/lib
INSTALLMAN?=$(PREFIX)/man
INSTALLINCLUDE?=$(PREFIX)/include
INSTALLPC?=$(PREFIX)/lib/pkgconfig
LDCONFIG?=ldconfig

DPREFIX=$(DESTDIR)$(PREFIX)
DINSTALLBIN=$(DESTDIR)$(INSTALLBIN)
DINSTALLLIB=$(DESTDIR)$(INSTALLLIB)
DINSTALLMAN=$(DESTDIR)$(INSTALLMAN)
DINSTALLINCLUDE=$(DESTDIR)$(INSTALLINCLUDE)
DINSTALLPC=$(DESTDIR)$(INSTALLPC)

MAJOR=$(shell sh version.sh --major)
VERSION=$(shell sh version.sh)
Expand Down Expand Up @@ -69,7 +71,7 @@ xdotool.static: xdotool.o $(CMDOBJS) xdo.o xdo_search.o
$(CC) -o xdotool.static xdotool.o xdo.o xdo_search.o $(CMDOBJS) $(LDFLAGS) -lm $(XDOTOOL_LIBS) $(LIBXDO_LIBS)

.PHONY: install
install: pre-install installlib installprog installman installheader post-install
install: pre-install installlib installprog installman installheader installpc post-install

.PHONY: pre-install
pre-install:
Expand Down Expand Up @@ -100,6 +102,11 @@ installheader: xdo.h
install -d $(DINSTALLINCLUDE)
install xdo.h $(DINSTALLINCLUDE)/xdo.h

.PHONY: installpc
installpc: libxdo.pc
install -d $(DINSTALLPC)
install libxdo.pc $(DINSTALLPC)/libxdo.pc

.PHONY: installman
installman: xdotool.1
install -d $(DINSTALLMAN)/man1
Expand Down Expand Up @@ -142,6 +149,9 @@ libxdo.a: xdo.o xdo_search.o
libxdo.$(VERLIBSUFFIX): libxdo.$(LIBSUFFIX)
ln -s $< $@

libxdo.pc:
sh pc.sh $(VERSION) $(INSTALLLIB) $(INSTALLINCLUDE) > libxdo.pc

# xdotool the binary requires libX11 now for XSelectInput and friends.
# This requirement will go away once more things are refactored into
# libxdo.
Expand Down
17 changes: 17 additions & 0 deletions pc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

VERSION=$1
LIBDIR=$2
INCLUDEDIR=$3

cat <<ENDPC
libdir=${LIBDIR}
includedir=${INCLUDEDIR}
Name: libxdo
Description: fake keyboard/mouse input, window management, and more
Version: ${VERSION}
Requires: x11
Libs: -L\${libdir} -lxdo
Cflags: -I\${includedir}
ENDPC

0 comments on commit d57fc02

Please sign in to comment.