From d1a43d5b5e0c8a1d7ea8752348d0beb7497e463a Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Tue, 29 May 2012 20:24:46 +0200
Debbug: 675077
Status: applied
Subject: [PATCH] Switch to use libbsd

---
 GNUmakefile    |    8 ++------
 debian/control |    3 ++-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 4899dbf..645cb01 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -29,13 +29,9 @@ SRCS=announce.c bencode.c buf.c ctl_server.c main.c network.c \
 LIBS=-levent -lcrypto -lpthread
 UNAME=$(shell uname)
 ifneq (, $(filter Linux GNU GNU/%, $(UNAME)))
-SRCS+=openbsd-compat/strlcpy.c
-SRCS+=openbsd-compat/strlcat.c
 SRCS+=openbsd-compat/sha1.c
-SRCS+=openbsd-compat/strtonum.c
-CFLAGS+=-DNO_STRLCPY
-CFLAGS+=-DNO_STRLCAT
-CFLAGS+=-DNO_STRTONUM
+LIBS+=$(shell pkg-config --libs libbsd-overlay)
+CFLAGS+=$(shell pkg-config --cflags libbsd-overlay)
 else
 ifeq ($(UNAME),sunos)
 SRCS+=openbsd-compat/err.c
diff --git a/debian/control b/debian/control
index b6c779f..045a991 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,8 @@ Source: unworkable
 Section: net
 Priority: optional
 Maintainer: Michael Stapelberg <stapelberg@debian.org>
-Build-Depends: debhelper (>= 5), libevent-dev, libssl-dev, bison
+Build-Depends: debhelper (>= 5), libbsd-dev, libevent-dev, libssl-dev, bison,
+ pkg-config
 Standards-Version: 3.9.3.1
 Homepage: http://code.google.com/p/unworkable/
 
-- 
1.7.10

