add new ntpd-openssl package to get a ntpd that is linked against openssl
[openwrt/svn-archive/archive.git] / net / ntpd / Makefile
index 910d12f5d8f820b6dff2279b9c4c988a50b6921d..a0f0b08a490af7e46ea352b88a3394307280efdb 100644 (file)
@@ -1,23 +1,23 @@
 #
-# Copyright (C) 2006-2008 OpenWrt.org
+# Copyright (C) 2006-2010 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id$
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ntp
-PKG_VERSION:=4.2.4p4
+PKG_VERSION:=4.2.6
 PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/
-PKG_MD5SUM:=fcb32a01e1ae3f9ed5bac86b12c7a1cc
+PKG_SOURCE_URL:=http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/
+PKG_MD5SUM:=4d64a99592b818aa9419fc9dcb149746
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_BUILD_DEPENDS:=libelf
+PKG_FIXUP:=libtool
+PKG_LIBTOOL_PATHS:=. sntp
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -45,6 +45,17 @@ define Package/ntpd/description
        This package contains the ntpd server.
 endef
 
+define Package/ntpd-openssl
+  $(call Package/ntpd/Default)
+  TITLE+= server (with OpenSSL support)
+  DEPENDS:=+openssl
+endef
+
+define Package/ntpd-openssl/description
+       $(call Package/ntpd/Default/description)
+       This package contains the ntpd server with OpenSSL support.
+endef
+
 define Package/ntpdate
   $(call Package/ntpd/Default)
   TITLE+=date
@@ -57,7 +68,7 @@ endef
 
 define Package/ntp-utils
   $(call Package/ntpd/Default)
-  DEPENDS:=+libreadline +libncurses
+  DEPENDS:=+libncurses
   TITLE+= utilities
 endef
 
@@ -92,27 +103,77 @@ endef
 
 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libelf
 
-define Build/Configure
+CONFIGURE_VARS += \
+       ac_cv_header_md5_h=no \
+       ac_cv_lib_rt_sched_setscheduler=no \
+       ac_cv_header_dns_sd_h=no 
+
+define Build/Template
+
+$(STAMP_BUILT)-$(2): $(STAMP_PREPARED)
+       -$(MAKE) -C $(PKG_BUILD_DIR) clean
        $(call Build/Configure/Default, \
                --disable-all-clocks \
                --disable-parse-clocks \
                --enable-NMEA \
                --enable-LOCAL-CLOCK \
                --enable-SHM \
-               --enable-linuxcaps \
-       )
-endef
+               --disable-linuxcaps \
+               $(3))
+       $(MAKE) -C $(PKG_BUILD_DIR) CFLAGS="$(TARGET_CFLAGS)"
+       ( cd $(PKG_BUILD_DIR); mv -f ntpd/ntpd $(PKG_NAME)-$(2) )
+       touch $$@
+
+$(STAMP_BUILT): $(STAMP_BUILT)-$(2)
+
+endef
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_ntpd-openssl),)
+  define Build/with-openssl
+    $(call Build/Template,ntpd-openssl,with-openssl, \
+               --with-crypto \
+               --with-openssl-incdir="$(STAGING_DIR)/usr/include" \
+               --with-openssl-libdir="$(STAGING_DIR)/usr/lib" \
+    )
+  endef
+endif
+$(eval $(Build/with-openssl))
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_ntpd),)
+  define Build/without-ssl
+    $(call Build/Template,ntpd,without-ssl)
+  endef
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_ntpdate),)
+  define Build/without-ssl
+    $(call Build/Template,ntpd,without-ssl)
+  endef
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_ntp-utils),)
+  define Build/without-ssl
+    $(call Build/Template,ntpd,without-ssl)
+  endef
+endif
+$(eval $(Build/without-ssl))
 
-define Build/Compile
-       $(MAKE) -C $(PKG_BUILD_DIR) \
-               CFLAGS="$(TARGET_CFLAGS)"
+define Package/ntpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME)-without-ssl $(1)/usr/sbin/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) ./files/ntp.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
 endef
 
-define Package/ntpd/install
+define Package/ntpd-openssl/install
        $(INSTALL_DIR) $(1)/usr/sbin/
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd/ntpd $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME)-with-openssl $(1)/usr/sbin/$(PKG_NAME)
        $(INSTALL_DIR) $(1)/etc
-       $(INSTALL_DATA) ./files/ntp.conf $(1)/etc/
+       $(INSTALL_CONF) ./files/ntp.conf $(1)/etc/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
        $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
@@ -122,6 +183,8 @@ endef
 define Package/ntpdate/install
        $(INSTALL_DIR) $(1)/usr/sbin/
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpdate/ntpdate $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ntpdate.init $(1)/etc/init.d/ntpdate
 endef
 
 define Package/ntp-utils/install
@@ -130,6 +193,7 @@ define Package/ntp-utils/install
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpq/ntpq $(1)/usr/sbin/
 endef
 
+$(eval $(call BuildPackage,ntpd-openssl))
 $(eval $(call BuildPackage,ntpd))
 $(eval $(call BuildPackage,ntpdate))
 $(eval $(call BuildPackage,ntp-utils))