4b96c6b68272307803842abb92cbe01ac0ff73f1
[packages.git] / libs / libdaemon / Makefile
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 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=libdaemon
12 PKG_VERSION:=0.10
13 PKG_RELEASE:=1
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=http://0pointer.de/lennart/projects/libdaemon/
18 PKG_MD5SUM:=6812a5e4063b5016f25e9a0cebbd3dd9
19 PKG_CAT:=zcat
20
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/libdaemon
26   SECTION:=libs
27   CATEGORY:=Libraries
28   TITLE:=A lightweight C library that eases the writing of UNIX daemons
29   DESCRIPTION:=A lightweight C library that eases the writing of UNIX daemons.\\\
30     libdaemon is a lightweight C library that eases the writing of UNIX daemons.\\\
31     It consists of the following parts:\\\
32     \\\
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.
41   URL:=http://0pointer.de/lennart/projects/libdaemon/
42 endef
43
44 define Build/Configure
45         (cd $(PKG_BUILD_DIR); rm -f config.cache; \
46                 $(TARGET_CONFIGURE_OPTS) \
47                 CFLAGS="$(TARGET_CFLAGS)" \
48                 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
49                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
50                 ac_cv_func_setpgrp_void=yes \
51                 ./configure \
52                         --target=$(GNU_TARGET_NAME) \
53                         --host=$(GNU_TARGET_NAME) \
54                         --build=$(GNU_HOST_NAME) \
55                         --program-prefix="" \
56                         --program-suffix="" \
57                         --prefix=/usr \
58                         --exec-prefix=/usr \
59                         --bindir=/usr/bin \
60                         --datadir=/usr/share \
61                         --includedir=/usr/include \
62                         --infodir=/usr/share/info \
63                         --libdir=/usr/lib \
64                         --libexecdir=/usr/lib \
65                         --localstatedir=/var \
66                         --mandir=/usr/share/man \
67                         --sbindir=/usr/sbin \
68                         --sysconfdir=/etc \
69                         $(DISABLE_LARGEFILE) \
70                         $(DISABLE_NLS) \
71                         --enable-shared \
72                         --enable-static \
73                         --disable-rpath \
74                         --with-gnu-ld \
75                         --disable-lynx \
76         );
77 endef
78
79 define Build/Compile
80         rm -rf $(PKG_INSTALL_DIR)
81         mkdir -p $(PKG_INSTALL_DIR)
82         $(MAKE) -C $(PKG_BUILD_DIR) \
83                 DESTDIR="$(PKG_INSTALL_DIR)" \
84                 all install
85 endef
86
87 define Package/libdaemon/install
88         install -d -m0755 $(1)/usr/lib
89         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdaemon.so.* $(1)/usr/lib/
90 endef
91
92 define Build/InstallDev
93         mkdir -p $(STAGING_DIR)/usr/include
94         $(CP) $(PKG_INSTALL_DIR)/usr/include/libdaemon $(STAGING_DIR)/usr/include/
95         mkdir -p $(STAGING_DIR)/usr/lib
96         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdaemon.a $(STAGING_DIR)/usr/lib/
97         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdaemon.so* $(STAGING_DIR)/usr/lib/
98         mkdir -p $(STAGING_DIR)/usr/lib/pkgconfig
99         $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libdaemon.pc $(STAGING_DIR)/usr/lib/pkgconfig/
100         $(SED) 's,-I$${includedir},,g' $(STAGING_DIR)/usr/lib/pkgconfig/libdaemon.pc
101         $(SED) 's,-L$${libdir},,g' $(STAGING_DIR)/usr/lib/pkgconfig/libdaemon.pc
102 endef
103
104 define Build/UninstallDev
105         rm -rf \
106                 $(STAGING_DIR)/usr/include/libdaemon \
107                 $(STAGING_DIR)/usr/lib/libdaemon.a \
108                 $(STAGING_DIR)/usr/lib/libdaemon.so* \
109                 $(STAGING_DIR)/usr/lib/pkgconfig/libdaemon.pc
110 endef
111
112 $(eval $(call BuildPackage,libdaemon))