[package] ctorrent, dansduardian: These packages don't use libtool, thus they
[openwrt/svn-archive/archive.git] / net / openntpd / 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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=openntpd
11 PKG_VERSION:=3.9p1
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/ \
16 ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenNTPD/ \
17 ftp://ftp.fr.openbsd.org/pub/OpenBSD/OpenNTPD/ \
18 ftp://ftp.sunet.se/pub/OpenBSD/OpenNTPD/
19 PKG_MD5SUM:=afc34175f38d08867c1403d9008600b3
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/openntpd
26 SUBMENU:=Time Synchronization
27 SECTION:=net
28 CATEGORY:=Network
29 TITLE:=NTP server
30 URL:=http://www.openntpd.org/
31 endef
32
33 define Package/openntpd/description
34 A free and easy to use NTP (Network Time Protocol) implementation.
35 endef
36
37 define Package/openntpd/conffiles
38 /etc/ntpd.conf
39 endef
40
41 define Package/openntpd/postinst
42 #!/bin/sh
43
44 name=ntp
45 id=50
46
47 # do not change below
48 # check if we are on real system
49 if [ -z "$${IPKG_INSTROOT}" ]; then
50 # create copies of passwd and group, if we use squashfs
51 rootfs=`mount |awk '/root/ { print $$5 }'`
52 if [ "$$rootfs" = "squashfs" ]; then
53 if [ -h /etc/group ]; then
54 rm /etc/group
55 cp -p /rom/etc/group /etc/group
56 fi
57 if [ -h /etc/passwd ]; then
58 rm /etc/passwd
59 cp -p /rom/etc/passwd /etc/passwd
60 fi
61 fi
62 fi
63
64 echo ""
65 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
66 echo "adding group $$name to /etc/group"
67 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
68 fi
69 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
70 echo "adding user $$name to /etc/passwd"
71 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
72 fi
73
74 grep -q '^ntp[[:space:]]*123/udp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
75 [ $$? -ne 0 ] && echo "ntp 123/udp" >>$${IPKG_INSTROOT}/etc/services || exit 0
76 endef
77
78 define Build/Configure
79 $(call Build/Configure/Default, \
80 --with-builtin-arc4random \
81 --with-privsep-user=ntp \
82 --with-adjtimex \
83 )
84 endef
85
86 define Build/Compile
87 $(MAKE) -C $(PKG_BUILD_DIR) \
88 CFLAGS="$(TARGET_CFLAGS) -DUSE_ADJTIMEX"
89 endef
90
91 define Package/openntpd/install
92 $(INSTALL_DIR) $(1)/usr/sbin/
93 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd $(1)/usr/sbin/
94 $(INSTALL_DIR) $(1)/etc
95 $(INSTALL_DATA) ./files/ntpd.conf $(1)/etc/
96 $(INSTALL_DIR) $(1)/etc/init.d
97 $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
98 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
99 $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
100 endef
101
102 $(eval $(call BuildPackage,openntpd))