1#
2# Copyright (C) 2006 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=libdaemon
11PKG_VERSION:=0.14
12PKG_RELEASE:=2
13
14PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15PKG_SOURCE_URL:=http://0pointer.de/lennart/projects/libdaemon/
16PKG_MD5SUM:=509dc27107c21bcd9fbf2f95f5669563
17
18#PKG_FIXUP:=libtool
19PKG_INSTALL:=1
20
21include $(INCLUDE_DIR)/package.mk
22
23define Package/libdaemon
24  SECTION:=libs
25  CATEGORY:=Libraries
26  TITLE:=A lightweight C library that eases the writing of UNIX daemons
27  URL:=http://0pointer.de/lennart/projects/libdaemon/
28endef
29
30define Package/libdaemon/description
31	libdaemon is a lightweight C library that eases the writing of UNIX daemons.
32	It consists of the following parts:
33	- A wrapper around fork() which does the correct daemonization procedure of a process
34	- A wrapper around syslog() for simpler and compatible log output to Syslog or STDERR
35	- An API for writing PID files
36	- An API for serializing UNIX signals into a pipe for usage with select() or poll()
37	- An API for running subprocesses with STDOUT and STDERR redirected to syslog
38
39	APIs like these are used in most daemon software available. It is not that
40	simple to get it done right and code duplication is not a goal.
41endef
42
43
44define Build/Configure
45	(cd $(PKG_BUILD_DIR); \
46		$(TARGET_CONFIGURE_OPTS) \
47		CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
48		CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
49		CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
50		LDFLAGS="$(TARGET_LDFLAGS)" \
51		PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
52		PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
53		./configure \
54		ac_cv_func_setpgrp_void=no \
55			ac_cv_func_setpgrp_void=yes \
56			ac_cv_func_memcmp_working=yes \
57			rb_cv_binary_elf=no \
58			rb_cv_negative_time_t=no \
59		--host=$(GNU_TARGET_NAME) \
60		--build=$(GNU_HOST_NAME) \
61		--prefix=$(PKG_INSTALL_DIR))
62endef
63
64
65#
66#define Build/Configure
67#	$(call Build/Configure/Default, \
68#		--enable-shared \
69#		--enable-static \
70#		--disable-lynx \
71#		--prefix=$(PKG_INSTALL_DIR))
72#endef
73#
74
75
76define Build/Compile
77	$(MAKE) -C $(PKG_BUILD_DIR) \
78		install
79endef
80
81
82
83TARGET_CFLAGS += $(FPIC)
84
85define Build/InstallDev
86	$(INSTALL_DIR) $(1)/usr/include
87	$(CP) $(PKG_INSTALL_DIR)/include/libdaemon $(1)/usr/include/
88	$(INSTALL_DIR) $(1)/usr/lib
89	$(CP) $(PKG_INSTALL_DIR)/lib/libdaemon.a $(1)/usr/lib/
90	$(CP) $(PKG_INSTALL_DIR)/lib/libdaemon.so* $(1)/usr/lib/
91	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
92	$(CP) $(PKG_INSTALL_DIR)/lib/pkgconfig/libdaemon.pc $(1)/usr/lib/pkgconfig/
93endef
94
95define Package/libdaemon/install
96	$(INSTALL_DIR) $(1)/usr/lib
97	$(CP) $(PKG_INSTALL_DIR)/lib/libdaemon.so.* $(1)/usr/lib/
98endef
99
100$(eval $(call BuildPackage,libdaemon))
101