summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--auto/help1
-rw-r--r--auto/make35
-rw-r--r--auto/options2
-rw-r--r--auto/summary1
-rwxr-xr-xconfigure1
-rw-r--r--src/unit.pc.in11
6 files changed, 50 insertions, 1 deletions
diff --git a/auto/help b/auto/help
index f3c42661..b6d9919f 100644
--- a/auto/help
+++ b/auto/help
@@ -20,6 +20,7 @@ cat << END
--modulesdir=DIR default: "\$libdir/unit/modules"
--datarootdir=DIR default: "\$prefix/share"
--mandir=DIR default: "\$datarootdir/man"
+ --pkgconfigdir=DIR default: "\$datarootdir/pkgconfig"
--localstatedir=DIR default: "\$prefix/var"
--statedir=DIR default: "\$localstatedir/lib/unit"
--runstatedir=DIR default: "\$localstatedir/run/unit"
diff --git a/auto/make b/auto/make
index ecf31826..abfd41ad 100644
--- a/auto/make
+++ b/auto/make
@@ -94,7 +94,9 @@ $NXT_BUILD_DIR/lib/$NXT_LIB_SHARED: \$(NXT_LIB_OBJS)
$NXT_BUILD_DIR/lib/$NXT_LIB_STATIC: \$(NXT_LIB_OBJS)
$NXT_STATIC_LINK \$@ \$(NXT_LIB_OBJS)
-$NXT_BUILD_DIR/lib/$NXT_LIB_UNIT_STATIC: \$(NXT_LIB_UNIT_OBJS)
+$NXT_BUILD_DIR/lib/$NXT_LIB_UNIT_STATIC: \$(NXT_LIB_UNIT_OBJS) \\
+ $NXT_BUILD_DIR/share/pkgconfig/unit.pc \\
+ $NXT_BUILD_DIR/share/pkgconfig/unit-uninstalled.pc
$NXT_STATIC_LINK \$@ \$(NXT_LIB_UNIT_OBJS)
END
@@ -397,6 +399,10 @@ libunit-install: $NXT_BUILD_DIR/lib/$NXT_LIB_UNIT_STATIC
|| install -d \$(DESTDIR)$NXT_LIBDIR
install -p -m u=rw,go=r $NXT_BUILD_DIR/lib/$NXT_LIB_UNIT_STATIC \
\$(DESTDIR)$NXT_LIBDIR/
+ test -d \$(DESTDIR)$NXT_PKGCONFIGDIR \
+ || install -d \$(DESTDIR)$NXT_PKGCONFIGDIR
+ install -p -m u=rw,go=r $NXT_BUILD_DIR/share/pkgconfig/unit.pc \
+ \$(DESTDIR)$NXT_PKGCONFIGDIR/
test -d \$(DESTDIR)$NXT_INCLUDEDIR \
|| install -d \$(DESTDIR)$NXT_INCLUDEDIR
install -p -m u=rw,go=r src/nxt_unit.h \
@@ -414,6 +420,8 @@ libunit-install: $NXT_BUILD_DIR/lib/$NXT_LIB_UNIT_STATIC
libunit-uninstall:
rm -f \$(DESTDIR)$NXT_LIBDIR/$NXT_LIB_UNIT_STATIC
@rmdir -p \$(DESTDIR)$NXT_LIBDIR 2>/dev/null || true
+ rm -f \$(DESTDIR)$NXT_PKGCONFIGDIR/unit.pc
+ @rmdir -p \$(DESTDIR)$NXT_PKGCONFIGDIR 2>/dev/null || true
rm -f \$(DESTDIR)$NXT_INCLUDEDIR/nxt_unit.h \
\$(DESTDIR)$NXT_INCLUDEDIR/nxt_unit_field.h \
\$(DESTDIR)$NXT_INCLUDEDIR/nxt_unit_request.h \
@@ -428,6 +436,31 @@ libunit-uninstall:
END
+# pkg-config files
+
+cat << END >> $NXT_MAKEFILE
+
+$NXT_BUILD_DIR/share/pkgconfig/unit.pc: src/unit.pc.in
+ sed -e "s|@PREFIX@|$NXT_PREFIX|" \\
+ -e "s|@LIBDIR@|$NXT_LIBDIR|" \\
+ -e "s|@CFLAGS@|-I$NXT_INCLUDEDIR|" \\
+ -e "s|@VERSION@|\$(NXT_VERSION)|" \\
+ -e "s|@EXTRA_LIBS@|$NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS|" \\
+ -e "s|@CONFARGS@|$(echo $NXT_CONFIGURE_OPTIONS | sed -e 's| -pie||' -e 's| --njs||')|" \\
+ -e "s|@MODULESDIR@|$NXT_MODULESDIR|" \\
+ < src/unit.pc.in > \$@
+
+$NXT_BUILD_DIR/share/pkgconfig/unit-uninstalled.pc: src/unit.pc.in
+ sed -e "s|@PREFIX@|$(pwd)/$NXT_BUILD_DIR|" \\
+ -e "s|@LIBDIR@|$(pwd)/$NXT_BUILD_DIR/lib|" \\
+ -e "s|@CFLAGS@|-I$(pwd)/src -I$(pwd)$NXT_BUILD_DIR/include|" \\
+ -e "s|@VERSION@|\$(NXT_VERSION)|" \\
+ -e "s|@EXTRA_LIBS@|$NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS|" \\
+ -e "s|@CONFARGS@|$(echo $NXT_CONFIGURE_OPTIONS | sed -e 's| -pie||' -e 's| --njs||')|" \\
+ < src/unit.pc.in > \$@
+
+END
+
# Makefile.
# *.dSYM is MacOSX Clang debug information.
diff --git a/auto/options b/auto/options
index 5487be7f..0550c699 100644
--- a/auto/options
+++ b/auto/options
@@ -73,6 +73,7 @@ do
;;
--datarootdir=*) NXT_DATAROOTDIR="$value" ;;
--mandir=*) NXT_MANDIR="$value" ;;
+ --pkgconfigdir=*) NXT_PKGCONFIGDIR="$value" ;;
--localstatedir=*) NXT_LOCALSTATEDIR="$value" ;;
--statedir=*) NXT_STATEDIR="$value" ;;
--state=*)
@@ -158,6 +159,7 @@ NXT_MODULESDIR="${NXT_MODULESDIR-"$NXT_LIBDIR/unit/modules"}"
NXT_DATAROOTDIR="${NXT_DATAROOTDIR-"$NXT_PREFIX/share"}"
NXT_MANDIR="${NXT_MANDIR-"$NXT_DATAROOTDIR/man"}"
+NXT_PKGCONFIGDIR="${NXT_PKGCONFIGDIR-"$NXT_DATAROOTDIR/pkgconfig"}"
NXT_LOCALSTATEDIR="${NXT_LOCALSTATEDIR-"$NXT_PREFIX/var"}"
NXT_STATEDIR="${NXT_STATEDIR-"$NXT_LOCALSTATEDIR/lib/unit"}"
diff --git a/auto/summary b/auto/summary
index fabe3b10..3aa41669 100644
--- a/auto/summary
+++ b/auto/summary
@@ -11,6 +11,7 @@ Unit configuration summary:
sbin directory: ............ "$NXT_SBINDIR"
lib directory: ............. "$NXT_LIBDIR"
include directory: ......... "$NXT_INCLUDEDIR"
+ pkgconfig directory: ....... "$NXT_PKGCONFIGDIR"
man pages directory: ....... "$NXT_MANDIR"
modules directory: ......... "$NXT_MODULESDIR"
state directory: ........... "$NXT_STATEDIR"
diff --git a/configure b/configure
index 8f2bd358..2cb4d457 100755
--- a/configure
+++ b/configure
@@ -62,6 +62,7 @@ mkdir -p $NXT_BUILD_DIR/lib
mkdir -p $NXT_BUILD_DIR/lib/unit/modules
mkdir -p $NXT_BUILD_DIR/sbin
mkdir -p $NXT_BUILD_DIR/share/man/man8
+mkdir -p $NXT_BUILD_DIR/share/pkgconfig
mkdir -p $NXT_BUILD_DIR/src
mkdir -p $NXT_BUILD_DIR/src/test
mkdir -p $NXT_BUILD_DIR/var/lib/unit
diff --git a/src/unit.pc.in b/src/unit.pc.in
new file mode 100644
index 00000000..4de0556f
--- /dev/null
+++ b/src/unit.pc.in
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+libdir=@LIBDIR@
+confargs=@CONFARGS@
+modulesdir=@MODULESDIR@
+
+Name: unit
+Description: library to embed Unit
+Version: @VERSION@
+URL: https://unit.nginx.org
+Cflags: @CFLAGS@
+Libs: -L${libdir} -lunit @EXTRA_LIBS@