LIB_VERSION := $(LIB_VERSION_MAJOR).$(LIB_VERSION_MINOR).$(LIB_VERSION_MICRO)
LIB_PKGCONFIG := $(LIB_NAME).pc
+LIB_PKGCONFIG_TRANS := $(LIB_NAME)-transparent.pc
LIB_STATIC := $(LIB_NAME).a
LIB_SHARED_SO := $(LIB_NAME).so
LIB_SONAME := $(LIB_SHARED_SO).$(LIB_VERSION_MAJOR)
LDFLAGS ?=
# Internal makefile variables
-MK_CPPFLAGS := -Iinclude/ -include bsd/bsd.h -D_GNU_SOURCE -D__REENTRANT
+MK_CPPFLAGS := -Iinclude/bsd/ -Iinclude/ -DLIBBSD_TRANSPARENT -D_GNU_SOURCE -D__REENTRANT
MK_CFLAGS :=
MK_LDFLAGS :=
mandir = ${prefix}/share/man
.PHONY: libs
-libs: $(LIB_STATIC) $(LIB_SHARED_SO) $(LIB_PKGCONFIG)
+libs: $(LIB_STATIC) $(LIB_SHARED_SO) $(LIB_PKGCONFIG) $(LIB_PKGCONFIG_TRANS)
.PHONY: man
man: $(LIB_MANS)
done
install -m644 $(LIB_MANS) $(DESTDIR)$(mandir)/man3
install -m644 $(LIB_PKGCONFIG) $(DESTDIR)$(pkgconfigdir)
+ install -m644 $(LIB_PKGCONFIG_TRANS) $(DESTDIR)$(pkgconfigdir)
ifeq ($(libdir),$(usrlibdir))
# If both dirs are the same, do a relative symlink.
ln -sf $(LIB_SHARED) $(DESTDIR)$(usrlibdir)/$(LIB_SHARED_SO)
.PHONY: clean
clean:
rm -f $(LIB_PKGCONFIG)
+ rm -f $(LIB_PKGCONFIG_TRANS)
rm -f $(LIB_SRCS_GEN) $(LIB_MANS_GEN)
rm -f $(LIB_STATIC_OBJS)
rm -f $(LIB_STATIC)
#define LIBBSD_ERR_H
#include <sys/cdefs.h>
-#include <err.h>
+
#include <stdarg.h>
+#ifdef LIBBSD_TRANSPARENT
+#include_next <err.h>
+#else
+#include <err.h>
+#endif
+
__BEGIN_DECLS
extern void warnc (int code, const char *format, ...);
extern void vwarnc (int code, const char *format, va_list ap);
#define LIBBSD_GETOPT_H
#include <sys/cdefs.h>
+
+#ifdef LIBBSD_TRANSPARENT
+#include_next <getopt.h>
+#else
#include <getopt.h>
+#endif
__BEGIN_DECLS
extern int optreset;
#include <sys/cdefs.h>
#include <sys/types.h>
+
+#ifdef LIBBSD_TRANSPARENT
+#include_next <stdio.h>
+#else
#include <stdio.h>
+#endif
__BEGIN_DECLS
const char *fmtcheck(const char *, const char *);
#include <sys/cdefs.h>
#include <sys/stat.h>
#include <stdint.h>
+
+#ifdef LIBBSD_TRANSPARENT
+#include_next <stdlib.h>
+#else
#include <stdlib.h>
+#endif
/* For compatibility with NetBSD, which defines humanize_number here. */
+#ifdef LIBBSD_TRANSPARENT
#include <libutil.h>
+#else
+#include <bsd/libutil.h>
+#endif
/* FIXME: Temporary inclusions to avoid API breakage, will be removed soon. */
#include <bsd/stdio.h>
#include <sys/cdefs.h>
#include <sys/types.h>
+#ifdef LIBBSD_TRANSPARENT
+#include_next <string.h>
+#else
+#include <string.h>
+#endif
+
/* FIXME: Temporary inclusion to avoid API breakage, will be removed soon. */
#include <bsd/stdio.h>
#ifndef LIBBSD_CDEFS_H
#define LIBBSD_CDEFS_H
+#ifdef LIBBSD_TRANSPARENT
+#include_next <sys/cdefs.h>
+#else
#include <sys/cdefs.h>
+#endif
#ifndef __dead2
# define __dead2
#include <sys/cdefs.h>
#include <sys/stat.h>
+#ifdef LIBBSD_TRANSPARENT
+#include_next <unistd.h>
+#else
+#include <unistd.h>
+#endif
+
#ifndef S_ISTXT
#define S_ISTXT S_ISVTX
#endif
--- /dev/null
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libbsd
+Description: Utility functions from BSD systems (transparent)
+Version: @VERSION@
+URL: http://libbsd.freedesktop.org/
+Libs: -L${libdir} -lbsd
+Cflags: -isystem ${includedir}/bsd -DLIBBSD_TRANSPARENT
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <bsd/getopt.h>
+#include <getopt.h>
int optreset = 0;
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <bsd/err.h>
+#include <err.h>
#include <errno.h>
#include <stdarg.h>
#include <errno.h>
#include <stdarg.h>
#include <unistd.h>
-
#include <libutil.h>
int
#include <errno.h>
#include <string.h>
-
-#include <bsd/stdlib.h>
+#include <stdlib.h>
static const char *__progname = NULL;
#include <string.h>
#include <termios.h>
#include <unistd.h>
-#include <bsd/readpassphrase.h>
+#include <readpassphrase.h>
#ifndef TCSASOFT
#define TCSASOFT 0