Compare commits

..

9 Commits
0.1.2 ... 0.1.4

Author SHA1 Message Date
Guillem Jover
391c75b427 Release libbsd 0.1.4 2009-05-29 02:48:00 +02:00
Guillem Jover
45783ae4ca Define N_SYMSIZE in case the system does not do it
Fixes build failures on some non-Linux ports.

Based-on-patch-by: Petr Salinger <Petr.Salinger@seznam.cz>
2009-05-29 02:45:54 +02:00
Guillem Jover
5902730a03 Create a relative symlink for .so if libdir and usrlibdir are the same 2009-05-29 02:28:49 +02:00
Guillem Jover
42601170ac Change @libdir@ in the pkg-config file to be $(usrlibdir)
The variable in the .pc file points to the directory where the .so
symlink is present, which is never going to be something like /lib,
but something like /usr/lib.
2009-05-25 10:02:26 +02:00
Guillem Jover
0bd48c4a4d Preserve the variables unexpanded in the pkg-config file 2009-05-25 09:57:14 +02:00
Guillem Jover
d03b2b07fc Release libbsd 0.1.3 2009-05-25 09:37:39 +02:00
Guillem Jover
cb1346e5b3 Export public functions as extern C 2009-05-25 09:25:13 +02:00
Guillem Jover
61fa98ea9e Add missing <stdarg.h> include in <bsd/err.h> 2009-05-25 09:12:45 +02:00
Guillem Jover
931e043430 Add new __RCSID macro
Define it to nothing, so that source imported from BSDs can be easily
compiled w/o needing to modify them.
2009-05-25 08:56:34 +02:00
9 changed files with 50 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
LIB_NAME := libbsd
LIB_VERSION_MAJOR := 0
LIB_VERSION_MINOR := 1
LIB_VERSION_MICRO := 2
LIB_VERSION_MICRO := 4
LIB_VERSION := $(LIB_VERSION_MAJOR).$(LIB_VERSION_MINOR).$(LIB_VERSION_MICRO)
LIB_PKGCONFIG := $(LIB_NAME).pc
@@ -82,13 +82,13 @@ CFLAGS ?= -g -Wall -Wextra -Wno-unused-variable
MK_CFLAGS := -Iinclude/ -include bsd/bsd.h -D_GNU_SOURCE -D__REENTRANT
prefix := /usr
exec_prefix :=
libdir := ${exec_prefix}/lib
usrlibdir := ${prefix}/lib
includedir := ${prefix}/include
pkgconfigdir := ${usrlibdir}/pkgconfig
mandir := ${prefix}/share/man
prefix = /usr
exec_prefix =
libdir = ${exec_prefix}/lib
usrlibdir = ${prefix}/lib
includedir = ${prefix}/include
pkgconfigdir = ${usrlibdir}/pkgconfig
mandir = ${prefix}/share/man
.PHONY: libs
libs: $(LIB_STATIC) $(LIB_SHARED_SO) $(LIB_PKGCONFIG)
@@ -108,13 +108,12 @@ man/md5.3bsd: man/mdX.3
src/hash/md5hl.c: src/hash/helper.c
sed -e 's:hashinc:bsd/md5.h:g' -e 's:HASH:MD5:g' $< > $@
# FIXME: the variables should be preserved unexpanded in the .pc file
$(LIB_PKGCONFIG): $(LIB_PKGCONFIG).in
sed -e 's:@VERSION@:$(LIB_VERSION):' \
-e 's:@prefix@:$(prefix):' \
-e 's:@exec_prefix@:$(exec_prefix):' \
-e 's:@libdir@:$(libdir):' \
-e 's:@includedir@:$(includedir):' \
-e 's:@prefix@:$(value prefix):' \
-e 's:@exec_prefix@:$(value exec_prefix):' \
-e 's:@libdir@:$(value usrlibdir):' \
-e 's:@includedir@:$(value includedir):' \
$< > $@
$(LIB_STATIC): $(LIB_STATIC_OBJS)
@@ -158,7 +157,13 @@ install: libs man
done
install -m644 $(LIB_MANS) $(DESTDIR)/$(mandir)/man3
install -m644 $(LIB_PKGCONFIG) $(DESTDIR)/$(pkgconfigdir)
ifeq ($(libdir),$(usrlibdir))
# If both dirs are the same, do a relative symlink.
ln -sf $(LIB_SHARED) $(DESTDIR)/$(usrlibdir)/$(LIB_SHARED_SO)
else
# Otherwise, do an absolute one.
ln -sf $(libdir)/$(LIB_SHARED) $(DESTDIR)/$(usrlibdir)/$(LIB_SHARED_SO)
endif
ln -sf $(LIB_SHARED) $(DESTDIR)/$(libdir)/$(LIB_SONAME)
.PHONY: clean

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2004, 2005, 2006 Guillem Jover
* Copyright © 2004, 2005, 2006, 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -61,6 +61,10 @@
# define __bounded__(x, y, z)
#endif
#ifndef __RCSID
# define __RCSID(x)
#endif
#ifndef __FBSDID
# define __FBSDID(x)
#endif

View File

@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Robert Millan
* Copyright © 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +28,15 @@
#ifndef LIBBSD_ERR_H
#define LIBBSD_ERR_H
#include <sys/cdefs.h>
#include <err.h>
#include <stdarg.h>
__BEGIN_DECLS
extern void warnc (int code, const char *format, ...);
extern void vwarnc (int code, const char *format, va_list ap);
extern void errc (int status, int code, const char *format, ...);
extern void verrc (int status, int code, const char *format, va_list ap);
__END_DECLS
#endif

View File

@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Robert Millan
* Copyright © 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,10 +28,13 @@
#ifndef LIBBSD_GETOPT_H
#define LIBBSD_GETOPT_H
#include <sys/cdefs.h>
#include <getopt.h>
__BEGIN_DECLS
extern int optreset;
int bsd_getopt (int, char **, char *);
__END_DECLS
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2008 Guillem Jover
* Copyright © 2008, 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,12 @@
#ifndef LIBBSD_INET_H
#define LIBBSD_INET_H
#include <sys/cdefs.h>
#include <stddef.h>
__BEGIN_DECLS
int inet_net_pton(int af, const char *src, void *dst, siez_t size);
__END_DECLS
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2004, 2005 Guillem Jover
* Copyright © 2004, 2005, 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,14 @@
#ifndef LIBBSD_RANDOM_H
#define LIBBSD_RANDOM_H
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
u_int32_t arc4random();
void arc4random_stir();
void arc4random_addrandom(u_char *dat, int datlen);
__END_DECLS
#endif

View File

@@ -1,7 +1,7 @@
/*
* Copyright © 2005 Aurelien Jarno
* Copyright © 2006 Robert Millan
* Copyright © 2008 Guillem Jover
* Copyright © 2008, 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,9 +29,11 @@
#ifndef LIBBSD_STDLIB_H
#define LIBBSD_STDLIB_H
#include <sys/cdefs.h>
#include <sys/stat.h>
#include <stdlib.h>
__BEGIN_DECLS
const char *fmtcheck (const char *, const char *);
char *getprogname ();
@@ -45,5 +47,6 @@ int heapsort (void *, size_t, size_t, int (*)(const void *, const void *));
mode_t getmode(const void *set, mode_t mode);
void *setmode(const char *mode_str);
__END_DECLS
#endif

View File

@@ -27,15 +27,18 @@
#ifndef LIBBSD_STRING_H
#define LIBBSD_STRING_H
#include <sys/cdefs.h>
#include <sys/types.h>
#include <stddef.h>
#include <stdio.h>
__BEGIN_DECLS
size_t strlcpy(char *dst, const char *src, size_t siz);
size_t strlcat(char *dst, const char *src, size_t siz);
char *fgetln(FILE *fp, size_t *lenp);
wchar_t *fgetwln(FILE * __restrict fp, size_t *lenp);
void strmode(mode_t mode, char *str);
__END_DECLS
#endif

View File

@@ -57,6 +57,9 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
#ifdef _NLIST_DO_AOUT
static int __aout_fdnlist(int, struct nlist *);
#ifndef N_SYMSIZE
#define N_SYMSIZE(a) ((a).a_syms)
#endif
#endif
#ifdef _NLIST_DO_ELF
static int __elf_fdnlist(int, struct nlist *);