Skip to content

Commit

Permalink
Add the pkg-config file
Browse files Browse the repository at this point in the history
  • Loading branch information
caramelli committed Feb 19, 2023
1 parent ff93e8c commit 25138b3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ VERSION=0.10.2

.PHONY: all clean install uninstall dist

all: libschrift.a demo stress
all: libschrift.a libschrift.pc demo stress

libschrift.a: schrift.o
$(AR) rc $@ schrift.o
$(RANLIB) $@
schrift.o: schrift.h

libschrift.pc: libschrift.pc.in
@sed 's,@prefix@,$(PREFIX),;s,@version@,$(VERSION),' libschrift.pc.in > $@

demo: demo.o libschrift.a
$(LD) $(EXTRAS_LDFLAGS) $@.o -o $@ -L$(X11LIB) -L. -lX11 -lXrender -lschrift -lm
demo.o: demo.c schrift.h util/utf8_to_utf32.h
Expand All @@ -32,11 +35,15 @@ clean:
rm -f demo
rm -f stress

install: libschrift.a schrift.h schrift.3
install: libschrift.a libschrift.pc schrift.h schrift.3
# libschrift.a
mkdir -p "$(DESTDIR)$(PREFIX)/lib"
cp -f libschrift.a "$(DESTDIR)$(PREFIX)/lib"
chmod 644 "$(DESTDIR)$(PREFIX)/lib/libschrift.a"
# libschrift.pc
mkdir -p "$(DESTDIR)$(PREFIX)/lib/pkgconfig"
cp -f libschrift.pc "$(DESTDIR)$(PREFIX)/lib/pkgconfig"
chmod 644 "$(DESTDIR)$(PREFIX)/lib/pkgconfig/libschrift.pc"
# schrift.h
mkdir -p "$(DESTDIR)$(PREFIX)/include"
cp -f schrift.h "$(DESTDIR)$(PREFIX)/include"
Expand All @@ -48,14 +55,15 @@ install: libschrift.a schrift.h schrift.3

uninstall:
rm -f "$(DESTDIR)$(PREFIX)/lib/libschrift.a"
rm -f "$(DESTDIR)$(PREFIX)/lib/pkgconfig/libschrift.pc"
rm -f "$(DESTDIR)$(PREFIX)/include/schrift.h"
rm -f "$(DESTDIR)$(MANPREFIX)/man3/schrift.3"

dist:
rm -rf "schrift-$(VERSION)"
mkdir -p "schrift-$(VERSION)"
cp -R README.md LICENSE CHANGELOG.md TODO.md schrift.3 \
Makefile config.mk \
Makefile config.mk libschrift.pc.in \
schrift.c schrift.h demo.c stress.c \
resources/ util/ \
"schrift-$(VERSION)"
Expand Down
10 changes: 10 additions & 0 deletions libschrift.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@prefix@
includedir=${prefix}/include
libdir=${prefix}/lib

Name: libschrift
Description: A lightweight TrueType font rendering library
Version: @version@
Libs: -L${libdir} -lschrift
Libs.private: -lm
Cflags: -I${includedir}

0 comments on commit 25138b3

Please sign in to comment.