d17185fefadf4b7532a432a55c0c830020571eca
[openwrt/svn-archive/archive.git] / net / ntpd / Makefile
1 #
2 # Copyright (C) 2006-2010 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:=ntp
11 PKG_VERSION:=4.2.6
12 PKG_RELEASE:=4
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/
16 PKG_MD5SUM:=4d64a99592b818aa9419fc9dcb149746
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19
20 PKG_BUILD_DEPENDS:=libelf
21 PKG_FIXUP:=libtool
22 PKG_LIBTOOL_PATHS:=. sntp
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/ntpd/Default
27 SUBMENU:=Time Synchronization
28 SECTION:=net
29 CATEGORY:=Network
30 TITLE:=ISC ntp
31 URL:=http://www.ntp.org/
32 endef
33
34 define Package/ntpd/Default/description
35 The ISC ntp suite is a collection of tools used to synchronize
36 the system clock with remote NTP time servers and run/montior
37 local NTP servers.
38 endef
39
40 define Package/ntpd
41 $(call Package/ntpd/Default)
42 TITLE+= server
43 VARIANT:=nossl
44 endef
45
46 define Package/ntpd/description
47 $(call Package/ntpd/Default/description)
48 This package contains the ntpd server.
49 endef
50
51 define Package/ntpd-ssl
52 $(call Package/ntpd/Default)
53 TITLE+= server (with OpenSSL support)
54 DEPENDS:=+libopenssl
55 VARIANT:=ssl
56 endef
57
58 define Package/ntpd-ssl/description
59 $(call Package/ntpd/Default/description)
60 This package contains the ntpd server with OpenSSL support.
61 endef
62
63 define Package/ntpdate
64 $(call Package/ntpd/Default)
65 TITLE+=date
66 VARIANT:=nossl
67 endef
68
69 define Package/ntpdate/description
70 $(call Package/ntpd/Default/description)
71 This package contains ntpdate.
72 endef
73
74 define Package/ntp-utils
75 $(call Package/ntpd/Default)
76 DEPENDS:=+libncurses
77 TITLE+= utilities
78 VARIANT:=nossl
79 endef
80
81 define Package/ntp-utils/description
82 $(call Package/ntpd/Default/description)
83 This package contains ntpdc and ntpq.
84 endef
85
86 define Package/ntpd/conffiles
87 /etc/ntp.conf
88 endef
89
90 define Package/ntpd/Default/postinst
91 #!/bin/sh
92 grep -q '^ntp[[:space:]]*123/udp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
93 [ $$? -ne 0 ] && echo "ntp 123/udp # Network Time Protocol" >>$${IPKG_INSTROOT}/etc/services || exit 0
94 grep -q '^ntp[[:space:]]*123/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
95 [ $$? -ne 0 ] && echo "ntp 123/tcp # Network Time Protocol" >>$${IPKG_INSTROOT}/etc/services || exit 0
96 endef
97
98 define Package/ntpdate/postinst
99 $(call Package/ntpd/Default/postinst)
100 endef
101
102 define Package/ntpd/postinst
103 $(call Package/ntpd/Default/postinst)
104 endef
105
106 define Package/ntp-utils/postinst
107 $(call Package/ntpd/Default/postinst)
108 endef
109
110 TARGET_CPPFLAGS += \
111 -I$(STAGING_DIR)/usr/include/libelf
112
113 CONFIGURE_VARS += \
114 ac_cv_header_md5_h=no \
115 ac_cv_lib_rt_sched_setscheduler=no \
116 ac_cv_header_dns_sd_h=no
117
118 CONFIGURE_ARGS += \
119 --disable-all-clocks \
120 --disable-parse-clocks \
121 --enable-NMEA \
122 --enable-LOCAL-CLOCK \
123 --enable-SHM \
124 --disable-linuxcaps
125
126 ifeq ($(BUILD_VARIANT),ssl)
127 CONFIGURE_ARGS += \
128 --with-crypto \
129 --with-openssl-incdir="$(STAGING_DIR)/usr/include" \
130 --with-openssl-libdir="$(STAGING_DIR)/usr/lib"
131 endif
132
133 define Package/ntpd/install
134 $(INSTALL_DIR) $(1)/usr/sbin/
135 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd/ntpd $(1)/usr/sbin/ntpd
136 $(INSTALL_DIR) $(1)/etc
137 $(INSTALL_CONF) ./files/ntp.conf $(1)/etc/
138 $(INSTALL_DIR) $(1)/etc/init.d
139 $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
140 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
141 $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
142 endef
143
144 Package/ntpd-ssl/install = $(Package/ntpd/install)
145
146 define Package/ntpdate/install
147 $(INSTALL_DIR) $(1)/usr/sbin/
148 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpdate/ntpdate $(1)/usr/sbin/
149 $(INSTALL_DIR) $(1)/etc/init.d
150 $(INSTALL_BIN) ./files/ntpdate.init $(1)/etc/init.d/ntpdate
151 endef
152
153 define Package/ntp-utils/install
154 $(INSTALL_DIR) $(1)/usr/sbin/
155 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpdc/ntpdc $(1)/usr/sbin/
156 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpq/ntpq $(1)/usr/sbin/
157 endef
158
159 $(eval $(call BuildPackage,ntpd))
160 $(eval $(call BuildPackage,ntpd-ssl))
161 $(eval $(call BuildPackage,ntpdate))
162 $(eval $(call BuildPackage,ntp-utils))