From fb98f5a866fbd2398499dcc4ad695aea822beefc Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 6 May 2019 14:41:52 -0500 Subject: [PATCH] lite: add build system for pkgconf-lite mode --- Makefile.lite | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Makefile.lite diff --git a/Makefile.lite b/Makefile.lite new file mode 100644 index 0000000..74a9bbb --- /dev/null +++ b/Makefile.lite @@ -0,0 +1,82 @@ +# Copyright (c) 2019 William Pitcock +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# This software is provided 'as is' and without any warranty, express or +# implied. In no event shall the authors be liable for any damages arising +# from the use of this software. + +# pkgconf-lite is a staticly-linked version of pkgconf that does not include +# all features, notably it does not include cross-compile support and MSVC +# support. It does not include the libpkgconf library. + +SRCS = \ + libpkgconf/argvsplit.c \ + libpkgconf/audit.c \ + libpkgconf/bsdstubs.c \ + libpkgconf/cache.c \ + libpkgconf/client.c \ + libpkgconf/dependency.c \ + libpkgconf/fileio.c \ + libpkgconf/fragment.c \ + libpkgconf/parser.c \ + libpkgconf/path.c \ + libpkgconf/personality.c \ + libpkgconf/pkg.c \ + libpkgconf/queue.c \ + libpkgconf/tuple.c \ + cli/getopt_long.c \ + cli/main.c \ + cli/renderer-msvc.c +OBJS = ${SRCS:.c=.o} +CFLAGS = ${STATIC} -I. -Ilibpkgconf -Icli -DSYSTEM_LIBDIR=\"${SYSTEM_LIBDIR}\" -DSYSTEM_INCLUDEDIR=\"${SYSTEM_INCLUDEDIR}\" -DPERSONALITY_PATH=\"${PERSONALITY_PATH}\" -DPKG_DEFAULT_PATH=\"${PKG_DEFAULT_PATH}\" +STATIC = + +all: pkgconf-lite + +libpkgconf/config.h: + @echo '#define PACKAGE_NAME "pkgconf-lite"' >> $@ + @echo '#define PACKAGE_BUGREPORT "https://git.dereferenced.org/pkgconf/pkgconf/issues/new"' >> $@ + @echo '#define PACKAGE_VERSION "1.6.1"' >> $@ + @echo '#define PACKAGE PACKAGE_NAME " " PACKAGE_VERSION' >> $@ + @echo '#define HAVE_STRLCPY' >> $@ + @echo '#define HAVE_STRLCAT' >> $@ + @echo '#define HAVE_STRNDUP' >> $@ + +pkgconf-lite: preflight libpkgconf/config.h ${OBJS} + ${CC} ${STATIC} -o $@ ${OBJS} + +clean: + rm -f libpkgconf/config.h + rm -f ${OBJS} + rm -f pkgconf-lite + +preflight: preflight-system-libdir preflight-system-includedir preflight-pkg-default-path preflight-personality-path + +preflight-system-libdir: + @if test -z "${SYSTEM_LIBDIR}"; then \ + echo "SYSTEM_LIBDIR not set."; \ + exit 1; \ + fi + +preflight-system-includedir: + @if test -z "${SYSTEM_INCLUDEDIR}"; then \ + echo "SYSTEM_INCLUDEDIR not set."; \ + exit 1; \ + fi + +preflight-personality-path: + @if test -z "${PERSONALITY_PATH}"; then \ + echo "PERSONALITY_PATH not set."; \ + exit 1; \ + fi + +preflight-pkg-default-path: + @if test -z "${PKG_DEFAULT_PATH}"; then \ + echo "PKG_DEFAULT_PATH not set."; \ + exit 1; \ + fi + +.PHONY: preflight preflight-system-libdir preflight-system-includedir preflight-pkg-default-path preflight-personality-path clean