a0f0b08a490af7e46ea352b88a3394307280efdb
[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:=3
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_DEPENDS:=libelf
19 PKG_FIXUP:=libtool
20 PKG_LIBTOOL_PATHS:=. sntp
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/ntpd/Default
25 SUBMENU:=Time Synchronization
26 SECTION:=net
27 CATEGORY:=Network
28 TITLE:=ISC ntp
29 URL:=http://www.ntp.org/
30 endef
31
32 define Package/ntpd/Default/description
33 The ISC ntp suite is a collection of tools used to synchronize
34 the system clock with remote NTP time servers and run/montior
35 local NTP servers.
36 endef
37
38 define Package/ntpd
39 $(call Package/ntpd/Default)
40 TITLE+= server
41 endef
42
43 define Package/ntpd/description
44 $(call Package/ntpd/Default/description)
45 This package contains the ntpd server.
46 endef
47
48 define Package/ntpd-openssl
49 $(call Package/ntpd/Default)
50 TITLE+= server (with OpenSSL support)
51 DEPENDS:=+openssl
52 endef
53
54 define Package/ntpd-openssl/description
55 $(call Package/ntpd/Default/description)
56 This package contains the ntpd server with OpenSSL support.
57 endef
58
59 define Package/ntpdate
60 $(call Package/ntpd/Default)
61 TITLE+=date
62 endef
63
64 define Package/ntpdate/description
65 $(call Package/ntpd/Default/description)
66 This package contains ntpdate.
67 endef
68
69 define Package/ntp-utils
70 $(call Package/ntpd/Default)
71 DEPENDS:=+libncurses
72 TITLE+= utilities
73 endef
74
75 define Package/ntp-utils/description
76 $(call Package/ntpd/Default/description)
77 This package contains ntpdc and ntpq.
78 endef
79
80 define Package/ntpd/conffiles
81 /etc/ntp.conf
82 endef
83
84 define Package/ntpd/Default/postinst
85 #!/bin/sh
86 grep -q '^ntp[[:space:]]*123/udp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
87 [ $$? -ne 0 ] && echo "ntp 123/udp # Network Time Protocol" >>$${IPKG_INSTROOT}/etc/services || exit 0
88 grep -q '^ntp[[:space:]]*123/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
89 [ $$? -ne 0 ] && echo "ntp 123/tcp # Network Time Protocol" >>$${IPKG_INSTROOT}/etc/services || exit 0
90 endef
91
92 define Package/ntpdate/postinst
93 $(call Package/ntpd/Default/postinst)
94 endef
95
96 define Package/ntpd/postinst
97 $(call Package/ntpd/Default/postinst)
98 endef
99
100 define Package/ntp-utils/postinst
101 $(call Package/ntpd/Default/postinst)
102 endef
103
104 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libelf
105
106 CONFIGURE_VARS += \
107 ac_cv_header_md5_h=no \
108 ac_cv_lib_rt_sched_setscheduler=no \
109 ac_cv_header_dns_sd_h=no
110
111 define Build/Template
112
113 $(STAMP_BUILT)-$(2): $(STAMP_PREPARED)
114 -$(MAKE) -C $(PKG_BUILD_DIR) clean
115 $(call Build/Configure/Default, \
116 --disable-all-clocks \
117 --disable-parse-clocks \
118 --enable-NMEA \
119 --enable-LOCAL-CLOCK \
120 --enable-SHM \
121 --disable-linuxcaps \
122 $(3))
123 $(MAKE) -C $(PKG_BUILD_DIR) CFLAGS="$(TARGET_CFLAGS)"
124 ( cd $(PKG_BUILD_DIR); mv -f ntpd/ntpd $(PKG_NAME)-$(2) )
125 touch $$@
126
127 $(STAMP_BUILT): $(STAMP_BUILT)-$(2)
128
129 endef
130
131 ifneq ($(SDK)$(CONFIG_PACKAGE_ntpd-openssl),)
132 define Build/with-openssl
133 $(call Build/Template,ntpd-openssl,with-openssl, \
134 --with-crypto \
135 --with-openssl-incdir="$(STAGING_DIR)/usr/include" \
136 --with-openssl-libdir="$(STAGING_DIR)/usr/lib" \
137 )
138 endef
139 endif
140 $(eval $(Build/with-openssl))
141
142 ifneq ($(SDK)$(CONFIG_PACKAGE_ntpd),)
143 define Build/without-ssl
144 $(call Build/Template,ntpd,without-ssl)
145 endef
146 endif
147
148 ifneq ($(SDK)$(CONFIG_PACKAGE_ntpdate),)
149 define Build/without-ssl
150 $(call Build/Template,ntpd,without-ssl)
151 endef
152 endif
153
154 ifneq ($(SDK)$(CONFIG_PACKAGE_ntp-utils),)
155 define Build/without-ssl
156 $(call Build/Template,ntpd,without-ssl)
157 endef
158 endif
159 $(eval $(Build/without-ssl))
160
161 define Package/ntpd/install
162 $(INSTALL_DIR) $(1)/usr/sbin/
163 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME)-without-ssl $(1)/usr/sbin/$(PKG_NAME)
164 $(INSTALL_DIR) $(1)/etc
165 $(INSTALL_CONF) ./files/ntp.conf $(1)/etc/
166 $(INSTALL_DIR) $(1)/etc/init.d
167 $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
168 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
169 $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
170 endef
171
172 define Package/ntpd-openssl/install
173 $(INSTALL_DIR) $(1)/usr/sbin/
174 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME)-with-openssl $(1)/usr/sbin/$(PKG_NAME)
175 $(INSTALL_DIR) $(1)/etc
176 $(INSTALL_CONF) ./files/ntp.conf $(1)/etc/
177 $(INSTALL_DIR) $(1)/etc/init.d
178 $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
179 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
180 $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
181 endef
182
183 define Package/ntpdate/install
184 $(INSTALL_DIR) $(1)/usr/sbin/
185 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpdate/ntpdate $(1)/usr/sbin/
186 $(INSTALL_DIR) $(1)/etc/init.d
187 $(INSTALL_BIN) ./files/ntpdate.init $(1)/etc/init.d/ntpdate
188 endef
189
190 define Package/ntp-utils/install
191 $(INSTALL_DIR) $(1)/usr/sbin/
192 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpdc/ntpdc $(1)/usr/sbin/
193 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpq/ntpq $(1)/usr/sbin/
194 endef
195
196 $(eval $(call BuildPackage,ntpd-openssl))
197 $(eval $(call BuildPackage,ntpd))
198 $(eval $(call BuildPackage,ntpdate))
199 $(eval $(call BuildPackage,ntp-utils))