summaryrefslogtreecommitdiffhomepage
path: root/sofort
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-06-30 20:12:07 +0000
committermidipix <writeonce@midipix.org>2018-08-05 05:58:46 -0400
commit4fa1e2390baaee46c456497cac7a1d39bf8a8d01 (patch)
tree87a37508cb7f679f8aba6e8d288da76adcccb1d2 /sofort
parent406b0dbc73c40ae1da6371f930b23cd1335b945d (diff)
downloadw32lib-4fa1e2390baaee46c456497cac7a1d39bf8a8d01.tar.bz2
w32lib-4fa1e2390baaee46c456497cac7a1d39bf8a8d01.tar.xz
build system: install-shared, install-static: added initial pkgconfig support.
Diffstat (limited to 'sofort')
-rw-r--r--sofort/pkgconf.mk40
-rwxr-xr-xsofort/pkgconf.sh92
2 files changed, 132 insertions, 0 deletions
diff --git a/sofort/pkgconf.mk b/sofort/pkgconf.mk
new file mode 100644
index 0000000..c28eae6
--- /dev/null
+++ b/sofort/pkgconf.mk
@@ -0,0 +1,40 @@
+ifeq ($(PKGCONF),no)
+
+install-pkgconf:
+
+else
+
+PKGCONF_VERSION = $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
+
+build/$(PACKAGE).pc: .pkgconf
+
+build/$(PACKAGE).pc:
+ @touch $@
+ @chmod 0644 $@
+ PKGCONF_NAME='$(PKGNAME)' \
+ PKGCONF_DESC='$(PKGDESC)' \
+ PKGCONF_USRC='$(PKGUSRC)' \
+ PKGCONF_REPO='$(PKGREPO)' \
+ PKGCONF_PSRC='$(PKGPSRC)' \
+ PKGCONF_DURL='$(PKGDURL)' \
+ PKGCONF_DEFS='$(PKGDEFS)' \
+ PKGCONF_LIBS='$(PKGLIBS)' \
+ \
+ PKGCONF_EXEC_PREFIX='$(EXEC_PREFIX)' \
+ PKGCONF_PREFIX='$(PREFIX)' \
+ PKGCONF_LIBDIR='$(LIBDIR)' \
+ PKGCONF_INCLUDEDIR='$(INCLUDEDIR)' \
+ PKGCONF_VERSION='$(PKGCONF_VERSION)' \
+ $(PROJECT_DIR)/sofort/pkgconf.sh > $@
+
+install-pkgconf: build/$(PACKAGE).pc
+ mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+ cp -p build/$(PACKAGE).pc $(DESTDIR)$(LIBDIR)/pkgconfig
+
+package-install-shared: install-pkgconf
+
+package-install-static: install-pkgconf
+
+.PHONY: .pkgconf install-pkgconf
+
+endif
diff --git a/sofort/pkgconf.sh b/sofort/pkgconf.sh
new file mode 100755
index 0000000..a3f8eb0
--- /dev/null
+++ b/sofort/pkgconf.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# prefix, exec_prefix
+if [ "$PKGCONF_PREFIX" = "$PKGCONF_EXEC_PREFIX" ]; then
+ echo 'prefix='${PKGCONF_PREFIX}
+ echo 'exec_prefix=${prefix}'
+else
+ echo 'prefix='${PKGCONF_PREFIX}
+ echo 'exec_prefix='${PKGCONF_EXEC_PREFIX}
+fi
+
+
+# (relative) includedir
+prefix=`dirname "$PKGCONF_INCLUDEDIR"`
+base=`basename "$PKGCONF_INCLUDEDIR"`
+
+if [ "$prefix/$base" = "$PKGCONF_PREFIX/$base" ]; then
+ echo 'includedir=${prefix}/'${base}
+else
+ echo 'includedir='${PKGCONF_INCLUDEDIR}
+fi
+
+if [ "$prefix/$base" = "$PKGCONF_PREFIX/include" ]; then
+ CFLAGS=
+else
+ CFLAGS='-I{includedir}'
+fi
+
+
+# (relative) libdir
+prefix=`dirname "$PKGCONF_LIBDIR"`
+base=`basename "$PKGCONF_LIBDIR"`
+
+if [ "$prefix/$base" = "$PKGCONF_EXEC_PREFIX/$base" ]; then
+ echo 'libdir=${prefix}/'${base}
+else
+ echo 'libdir='${PKGCONF_LIBDIR}
+fi
+
+if [ "$prefix/$base" = "$PKGCONF_EXEC_PREFIX/lib" ]; then
+ LDFLAGS='-l'${PKGCONF_NAME}
+elif [ "$prefix/$base" = "$PKGCONF_EXEC_PREFIX/lib64" ]; then
+ LDFLAGS='-l'${PKGCONF_NAME}
+else
+ LDFLAGS='-L'${PKGCONF_LIBDIR} '-l'${PKGCONF_NAME}
+fi
+
+
+# name, description, url, version
+echo
+echo 'Name: '${PKGCONF_NAME}
+echo 'Description: '${PKGCONF_DESC}
+echo 'URL: '${PKGCONF_USRC}
+echo 'Version: '${PKGCONF_VERSION}
+
+
+# repo (optional)
+if ! [ -z "$PKGCONF_REPO" ]; then
+ echo 'Repo: '${PKGCONF_REPO}
+fi
+
+
+# patches (optional)
+if ! [ -z "$PKGCONF_PSRC" ]; then
+ echo 'Patches: '${PKGCONF_PSRC}
+fi
+
+
+# disto (optional)
+if ! [ -z "$PKGCONF_DURL" ]; then
+ echo 'Distro: '${PKGCONF_DURL}
+fi
+
+
+# Cflags
+if [ -z "$PKGCONF_DEFS" ] && [ -z "$CFLAGS" ]; then
+ echo 'Cflags:'
+elif [ -z "$PKGCONF_DEFS" ]; then
+ echo 'Cflags: '${CFLAGS}
+elif [ -z "$CFLAGS" ]; then
+ echo 'Cflags: '${PKGCONF_DEFS}
+else
+ echo 'Cflags: '${PKGCONF_DEFS} ${CFLAGS}
+fi
+
+
+# Libs
+if [ -z "$PKGCONF_LIBS" ]; then
+ echo 'Libs: '${LDFLAGS}
+else
+ echo 'Libs: '${PKGCONF_LIBS} ${LDFLAGS}
+fi