Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate and install a pkg-config file. #142

Merged
merged 5 commits into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions MANIFEST
Expand Up @@ -5,3 +5,5 @@ lib/libutf8proc.a
lib/libutf8proc.so -> libutf8proc.so.2.2.0
lib/libutf8proc.so.2 -> libutf8proc.so.2.2.0
lib/libutf8proc.so.2.2.0
lib/pkgconfig/
lib/pkgconfig/libutf8proc.pc
34 changes: 23 additions & 11 deletions Makefile
Expand Up @@ -34,8 +34,9 @@ endif

# installation directories (for 'make install')
prefix=/usr/local
libdir=$(prefix)/lib
includedir=$(prefix)/include
libdir=lib
tlsa marked this conversation as resolved.
Show resolved Hide resolved
includedir=include
pkgconfigdir=$(libdir)/pkgconfig

# meta targets

Expand All @@ -45,6 +46,7 @@ all: libutf8proc.a libutf8proc.$(SHLIB_EXT)

clean:
rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_VERS_EXT) libutf8proc.$(SHLIB_EXT)
rm -f libutf8proc.pc
ifneq ($(OS),Darwin)
rm -f libutf8proc.so.$(MAJOR)
endif
Expand Down Expand Up @@ -81,20 +83,30 @@ libutf8proc.so: libutf8proc.so.$(MAJOR).$(MINOR).$(PATCH)
ln -f -s libutf8proc.so.$(MAJOR).$(MINOR).$(PATCH) $@.$(MAJOR)

libutf8proc.$(MAJOR).dylib: utf8proc.o
$(CC) $(LDFLAGS) -dynamiclib -o $@ $^ -install_name $(libdir)/$@ -Wl,-compatibility_version -Wl,$(MAJOR) -Wl,-current_version -Wl,$(MAJOR).$(MINOR).$(PATCH)
$(CC) $(LDFLAGS) -dynamiclib -o $@ $^ -install_name $(prefix)/$(libdir)/$@ -Wl,-compatibility_version -Wl,$(MAJOR) -Wl,-current_version -Wl,$(MAJOR).$(MINOR).$(PATCH)

libutf8proc.dylib: libutf8proc.$(MAJOR).dylib
ln -f -s libutf8proc.$(MAJOR).dylib $@

install: libutf8proc.a libutf8proc.$(SHLIB_EXT) libutf8proc.$(SHLIB_VERS_EXT)
mkdir -m 755 -p $(DESTDIR)$(includedir)
$(INSTALL) -m 644 utf8proc.h $(DESTDIR)$(includedir)
mkdir -m 755 -p $(DESTDIR)$(libdir)
$(INSTALL) -m 644 libutf8proc.a $(DESTDIR)$(libdir)
$(INSTALL) -m 755 libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)
ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.$(SHLIB_EXT)
libutf8proc.pc: libutf8proc.pc.in
sed \
-e 's#PREFIX#$(prefix)#' \
-e 's#LIBDIR#$(libdir)#' \
-e 's#INCLUDEDIR#$(includedir)#' \
-e 's#VERSION#$(MAJOR).$(MINOR).$(PATCH)#' \
libutf8proc.pc.in > libutf8proc.pc

install: libutf8proc.a libutf8proc.$(SHLIB_EXT) libutf8proc.$(SHLIB_VERS_EXT) libutf8proc.pc
mkdir -m 755 -p $(DESTDIR)$(prefix)/$(includedir)
$(INSTALL) -m 644 utf8proc.h $(DESTDIR)$(prefix)/$(includedir)
mkdir -m 755 -p $(DESTDIR)$(prefix)/$(libdir)
$(INSTALL) -m 644 libutf8proc.a $(DESTDIR)$(prefix)/$(libdir)
$(INSTALL) -m 755 libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(prefix)/$(libdir)
mkdir -m 755 -p $(DESTDIR)$(prefix)/$(pkgconfigdir)
$(INSTALL) -m 644 libutf8proc.pc $(DESTDIR)$(prefix)/$(pkgconfigdir)/libutf8proc.pc
ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(prefix)/$(libdir)/libutf8proc.$(SHLIB_EXT)
ifneq ($(OS),Darwin)
ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.so.$(MAJOR)
ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(prefix)/$(libdir)/libutf8proc.so.$(MAJOR)
endif

MANIFEST.new:
Expand Down
10 changes: 10 additions & 0 deletions libutf8proc.pc.in
@@ -0,0 +1,10 @@
prefix=PREFIX
exec_prefix=${prefix}
libdir=${prefix}/LIBDIR
includedir=${prefix}/INCLUDEDIR

Name: libutf8proc
Description: UTF8 processing
Version: VERSION
Libs: -L${libdir} -lutf8proc
Cflags: -I${includedir} -DUTF8PROC_EXPORTS