aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-10-08 00:19:18 +0100
committerRoy Marples <roy@marples.name>2009-10-08 00:20:43 +0100
commit07f9be7b1c92fbb64c4a08dffb4db30da8764d66 (patch)
treeaf672a5ba3ab19efbdcc63a7796ffd0b610c2984
parent42ca23b878cc43a710b1a2bf0899864bc671663b (diff)
Add pkg-config support, fixes #187.
-rw-r--r--Makefile12
-rw-r--r--Makefile.inc3
-rw-r--r--README1
-rw-r--r--pkgconfig/.gitignore2
-rw-r--r--pkgconfig/Makefile11
-rw-r--r--pkgconfig/einfo.pc.in9
-rw-r--r--pkgconfig/openrc.pc.in10
-rw-r--r--src/rc/Makefile3
8 files changed, 47 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 86bb2dc0..06e48eb1 100644
--- a/Makefile
+++ b/Makefile
@@ -2,9 +2,7 @@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
-NAME= openrc
-VERSION= 0.5.0
-PKG= ${NAME}-${VERSION}
+include Makefile.inc
SUBDIR= conf.d etc init.d man sh src
@@ -16,6 +14,14 @@ _OLDNET_SH= case "${MKOLDNET}" in \
_OLDNET!= ${_OLDNET_SH}
SUBDIR+= ${_OLDNET}$(shell ${_OLDNET_SH})
+# Build pkgconfig or not
+_PKGCONFIG_SH= case "${MKPKGCONFIG}" in \
+ [Yy][Ee][Ss]|"") echo "pkgconfig";; \
+ *) echo "";; \
+ esac
+_PKGCONFIG!= ${_PKGCONFIG_SH}
+SUBDIR+= ${_PKGCONFIG}$(shell ${_PKGCONFIG_SH})
+
# We need to ensure that runlevels is done last
SUBDIR+= runlevels
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644
index 00000000..a23b0918
--- /dev/null
+++ b/Makefile.inc
@@ -0,0 +1,3 @@
+NAME= openrc
+VERSION= 0.5.0
+PKG= ${NAME}-${VERSION}
diff --git a/README b/README
index f287e25b..3e64f628 100644
--- a/README
+++ b/README
@@ -11,6 +11,7 @@ PROGLDFLAGS=-static
LIBNAME=lib64
DESTDIR=/tmp/openrc-image
MKPAM=pam
+MKPKGCONFIG=no
MKTERMCAP=ncurses
MKTERMCAP=termcap
MKOLDNET=yes
diff --git a/pkgconfig/.gitignore b/pkgconfig/.gitignore
new file mode 100644
index 00000000..e50bf9c5
--- /dev/null
+++ b/pkgconfig/.gitignore
@@ -0,0 +1,2 @@
+einfo.pc
+openrc.pc
diff --git a/pkgconfig/Makefile b/pkgconfig/Makefile
new file mode 100644
index 00000000..cdcf8be8
--- /dev/null
+++ b/pkgconfig/Makefile
@@ -0,0 +1,11 @@
+DIR= ${LIBDIR}/pkgconfig
+SRCS= einfo.pc.in openrc.pc.in
+INC= einfo.pc openrc.pc
+
+sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
+
+SED_EXTRA= -e 's:@VERSION@:${VERSION}:g'
+
+MK= ../mk
+include ../Makefile.inc
+include ${MK}/scripts.mk
diff --git a/pkgconfig/einfo.pc.in b/pkgconfig/einfo.pc.in
new file mode 100644
index 00000000..b5242a66
--- /dev/null
+++ b/pkgconfig/einfo.pc.in
@@ -0,0 +1,9 @@
+prefix=@PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/@LIB@
+includedir=/usr/include
+
+Name: einfo
+Description: Pretty console informational display
+Version: @VERSION@
+Libs: -L${libdir} -leinfo
diff --git a/pkgconfig/openrc.pc.in b/pkgconfig/openrc.pc.in
new file mode 100644
index 00000000..9a8a9165
--- /dev/null
+++ b/pkgconfig/openrc.pc.in
@@ -0,0 +1,10 @@
+prefix=@PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/@LIB@
+includedir=/usr/include
+
+Name: OpenRC
+Description: Universal init system
+Version: @VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lrc
diff --git a/src/rc/Makefile b/src/rc/Makefile
index b5fc189f..78b862df 100644
--- a/src/rc/Makefile
+++ b/src/rc/Makefile
@@ -34,6 +34,7 @@ CPPFLAGS+= -I../includes -I../librc -I../libeinfo
LDFLAGS+= -L../librc -L../libeinfo
LDADD+= -lutil -lrc -leinfo
+include ../../Makefile.inc
MK= ../../mk
include ${MK}/debug.mk
include ${MK}/prog.mk
@@ -46,7 +47,7 @@ include ${MK}/${MKPAM}.mk
${SRCS}: version.h
version.h:
- sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
+ echo "#define VERSION \"${VERSION}${GITVER}\"" >version.h
if test -n "${BRANDING}"; then \
echo "#define BRANDING \"${BRANDING}\"" >> version.h; \
fi