add missing dependency on freeradius to freeradius-mod-radutmp, tweak makefile
[openwrt/svn-archive/archive.git] / net / freeradius / Makefile
index 0d0e964f4c35aecd51410c93a430bc3f73cde3a1..b0ced476c4e99536c9cb3e748c832473191e4157 100644 (file)
@@ -1,5 +1,5 @@
 # 
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2008 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=freeradius
-PKG_VERSION:=1.1.1
+PKG_VERSION:=1.1.6
 PKG_RELEASE:=1
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/radius/ \
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/radius/old/ \
        http://freeradius.portal-to-web.de/ \
        ftp://ftp.uk.freeradius.org/pub/radius/
-PKG_MD5SUM:=b38b24f6352090fdb571b9e8da52e12e
-PKG_CAT:=zcat
-
-PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
-
-PKG_CONFIGURE_OPTIONS := \
-       --enable-shared \
-       --disable-static \
-       --disable-ltdl-install \
-       --with-ltdl-include="$(STAGING_DIR)/usr/include" \
-       --with-ltdl-lib="$(STAGING_DIR)/usr/lib" \
-       --with-openssl-includes="$(STAGING_DIR)/usr/include" \
-       --with-openssl-libraries="$(STAGING_DIR)/usr/lib" \
-       --enable-strict-dependencies \
-       --with-raddbdir=/etc/freeradius \
-       --without-edir \
-       --without-snmp \
-       --with-experimental-modules \
-       --without-rlm_attr-rewrite \
-       --without-rlm_checkval \
-       --without-rlm_counter \
-       --without-rlm_dbm \
-       --with-rlm_eap \
-       --without-rlm_eap_sim \
-       --without-rlm_example \
-       --without-rlm_ippool \
-       --without-rlm_krb5 \
-       --without-rlm_otp \
-       --without-rlm_pam \
-       --without-rlm_perl \
-       --without-rlm_python \
-       --without-rlm_radutmp \
-       --without-rlm_smb \
-       --with-rlm_sql \
-       --with-rlm_sqlcounter \
-       --without-rlm_sql_db2 \
-       --without-rlm_sql_freetds \
-       --without-rlm_sql_iodbc \
-       --without-rlm_sql_oracle \
-       --without-rlm_sql_sybase \
-       --without-rlm_sql_unixodbc \
-       --without-rlm_sql_log \
-       --without-rlm_unix \
-
-ifneq ($(CONFIG_PACKAGE_freeradius-mod-ldap),)
-PKG_CONFIGURE_LIBS += -lcrypto -lssl
-PKG_CONFIGURE_OPTIONS += \
-       --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
-       --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
-else
-PKG_CONFIGURE_OPTIONS += --without-rlm_ldap
-endif
-ifneq ($(CONFIG_PACKAGE_freeradius-mod-sql-mysql),)
-PKG_CONFIGURE_LIBS += -lz
-PKG_CONFIGURE_OPTIONS += \
-       --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
-       --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql" \
-       --without-threads
-else
-PKG_CONFIGURE_OPTIONS += --without-rlm_sql_mysql
-endif
-ifneq ($(CONFIG_PACKAGE_freeradius-mod-sql-pgsql),)
-PKG_CONFIGURE_OPTIONS += \
-       --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
-       --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
-else
-PKG_CONFIGURE_OPTIONS += --without-rlm_sql_postgresql
-endif
+PKG_MD5SUM:=2c29ab90cc30aa3b92fbd78030ccc198
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/freeradius
+define Package/freeradius/Default
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libltdl +libopenssl +libpthread
-  TITLE:=A flexible RADIUS server
   URL:=http://www.freeradius.org/
 endef
 
+define Package/freeradius
+  $(call Package/freeradius/Default)
+  DEPENDS:=+libltdl +libopenssl +libpthread +libreadline
+  TITLE:=A flexible RADIUS server
+  MENU:=1
+endef
+
 define Package/freeradius/conffiles
 /etc/freeradius/clients.conf
 /etc/freeradius/radiusd.conf
 endef
 
 define Package/freeradius-democerts
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=Demo certificates to test the server
 endef
 
 define Package/freeradius-mod-chap
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=CHAP module
 endef
 
 define Package/freeradius-mod-detail
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=Detailed accounting module
 endef
 
 define Package/freeradius-mod-eap
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=Base EAP module
 endef
@@ -130,43 +67,55 @@ define Package/freeradius-mod-eap/conffiles
 endef
 
 define Package/freeradius-mod-eap-gtc
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-eap
   TITLE:=EAP/GTC module
 endef
 
 define Package/freeradius-mod-eap-md5
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-eap
   TITLE:=EAP/MD5 module
 endef
 
 define Package/freeradius-mod-eap-mschapv2
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-eap
   TITLE:=EAP/MS-CHAPv2 module
 endef
 
 define Package/freeradius-mod-eap-peap
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-eap
   TITLE:=EAP/PEAP module
 endef
 
 define Package/freeradius-mod-eap-tls
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-eap
   TITLE:=EAP/TLS module
 endef
 
 define Package/freeradius-mod-eap-ttls
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-eap-tls
   TITLE:=EAP/TTLS module
 endef
 
+define Package/freeradius-mod-exec
+  $(call Package/freeradius/Default)
+  DEPENDS:=freeradius
+  TITLE:=EXEC module
+endef
+
+define Package/freeradius-mod-attr-rewrite
+  $(call Package/freeradius/Default)
+  DEPENDS:=freeradius
+  TITLE:=ATTR rewrite module
+endef
+
 define Package/freeradius-mod-files
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=Module using local files for authorization
 endef
@@ -178,7 +127,7 @@ define Package/freeradius-mod-files/conffiles
 endef
 
 define Package/freeradius-mod-ldap
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius +libopenldap
   TITLE:=LDAP module
 endef
@@ -188,19 +137,19 @@ define Package/freeradius-mod-ldap/conffiles
 endef
 
 define Package/freeradius-mod-mschap
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=MS-CHAP and MS-CHAPv2 module
 endef
 
 define Package/freeradius-mod-pap
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=PAP module
 endef
 
 define Package/freeradius-mod-preprocess
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=Request pre-processing module
 endef
@@ -211,7 +160,7 @@ define Package/freeradius-mod-preprocess/conffiles
 endef
 
 define Package/freeradius-mod-realm
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=Realms handling module
 endef
@@ -221,71 +170,154 @@ define Package/freeradius-mod-realm/conffiles
 endef
 
 define Package/freeradius-mod-sql
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=Base SQL module
 endef
 
 define Package/freeradius-mod-sql-mysql
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-sql +libmysqlclient
   TITLE:=MySQL module
 endef
 
 define Package/freeradius-mod-sql-pgsql
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-sql +libpq
   TITLE:=PostgreSQL module
 endef
 
 define Package/freeradius-mod-sqlcounter
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius-mod-sql
   TITLE:=Generic SQL Counter module
 endef
 
+define Package/freeradius-mod-radutmp
+  $(call Package/freeradius/Default)
+  DEPENDS:=freeradius
+  TITLE:=Radius UTMP module
+endef
+
 define Package/freeradius-utils
-  $(call Package/freeradius)
+  $(call Package/freeradius/Default)
   DEPENDS:=freeradius
   TITLE:=Misc. client utilities
 endef
 
-define Build/Configure
-       (cd $(PKG_BUILD_DIR); rm -f config.cache; \
-               $(TARGET_CONFIGURE_OPTS) \
-               CFLAGS="$(TARGET_CFLAGS)" \
-               CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
-               LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -L$(PKG_INSTALL_DIR)/usr/lib/freeradius" \
-               LIBS="$(PKG_CONFIGURE_LIBS)" \
-               sys_lib_search_path_spec="$(STAGING_DIR)/usr/lib $(STAGING_DIR)/lib" \
-               MYSQL_CONFIG="no" \
-               ./configure \
-                       --target=$(GNU_TARGET_NAME) \
-                       --host=$(GNU_TARGET_NAME) \
-                       --build=$(GNU_HOST_NAME) \
-                       --program-prefix="" \
-                       --program-suffix="" \
-                       --prefix=/usr \
-                       --exec-prefix=/usr \
-                       --bindir=/usr/bin \
-                       --datadir=/usr/share \
-                       --includedir=/usr/include \
-                       --infodir=/usr/share/info \
-                       --libdir=/usr/lib/freeradius \
-                       --libexecdir=/usr/lib/freeradius \
-                       --localstatedir=/var \
-                       --mandir=/usr/share/man \
-                       --sbindir=/usr/sbin \
-                       --sysconfdir=/etc \
-                       $(DISABLE_LARGEFILE) \
-                       $(DISABLE_NLS) \
-                       $(PKG_CONFIGURE_OPTIONS) \
-       );
-endef
+CONFIGURE_ARGS+= \
+       --libdir=/usr/lib/freeradius \
+       --libexecdir=/usr/lib/freeradius \
+       --enable-shared \
+       --disable-static \
+       --disable-developer \
+       --with-openssl-includes="$(STAGING_DIR)/usr/include" \
+       --with-openssl-libraries="$(STAGING_DIR)/usr/lib" \
+       --enable-strict-dependencies \
+       --with-raddbdir=/etc/freeradius \
+       --without-edir \
+       --without-snmp \
+       --with-experimental-modules \
+       --without-rlm_checkval \
+       --without-rlm_counter \
+       --without-rlm_dbm \
+       --with-rlm_eap \
+       --without-rlm_eap_sim \
+       --without-rlm_example \
+       --without-rlm_ippool \
+       --without-rlm_krb5 \
+       --without-rlm_otp \
+       --without-rlm_pam \
+       --without-rlm_perl \
+       --without-rlm_python \
+       --without-rlm_smb \
+       --with-rlm_sql \
+       --with-rlm_sqlcounter \
+       --without-rlm_sqlhpwippool \
+       --without-rlm_sqlippool \
+       --without-rlm_sql_db2 \
+       --without-rlm_sql_firebird \
+       --without-rlm_sql_freetds \
+       --without-rlm_sql_iodbc \
+       --without-rlm_sql_oracle \
+       --without-rlm_sql_sybase \
+       --without-rlm_sql_unixodbc \
+       --without-rlm_sql_log \
+       --without-rlm_unix \
+
+PKG_DICTIONARIES:= \
+       freeradius freeradius.internal \
+       rfc2865 rfc2866 rfc2867 rfc2868 rfc2869 rfc3162 rfc3576 rfc3580 \
+       rfc4372 rfc4675 rfc4679 \
+       microsoft \
+       wispr \
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-ldap),)
+  CONFIGURE_ARGS+= \
+               --with-rlm_ldap-include-dir="$(STAGING_DIR)/usr/include" \
+               --with-rlm_ldap-lib-dir="$(STAGING_DIR)/usr/lib"
+  CONFIGURE_LIBS+= -lcrypto -lssl
+else
+  CONFIGURE_ARGS+= --without-rlm_ldap
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-sql-mysql),)
+  CONFIGURE_ARGS+= \
+               --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
+               --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql" \
+               --without-threads
+  CONFIGURE_LIBS+= -lz
+else
+  CONFIGURE_ARGS+= --without-rlm_sql_mysql
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-sql-pgsql),)
+  CONFIGURE_ARGS+= \
+               --with-rlm_sql_postgresql-include-dir="$(STAGING_DIR)/usr/include" \
+               --with-rlm_sql_postgresql-lib-dir="$(STAGING_DIR)/usr/lib"
+else
+  CONFIGURE_ARGS+= --without-rlm_sql_postgresql
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-peap),)
+  CONFIGURE_ARGS+= --with-rlm_eap_peap
+  CONFIGURE_LIBS+= -lcrypto -lssl
+else
+  CONFIGURE_ARGS+= --without-rlm_eap_peap
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-tls),)
+  CONFIGURE_ARGS+= --with-rlm_eap_tls
+  CONFIGURE_LIBS+= -lcrypto -lssl
+else
+  CONFIGURE_ARGS+= --without-rlm_eap_tls
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-eap-ttls),)
+  CONFIGURE_ARGS+= --with-rlm_eap_ttls
+  CONFIGURE_LIBS+= -lcrypto -lssl
+else
+  CONFIGURE_ARGS+= --without-rlm_eap_ttls
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-attr-rewrite),)
+  CONFIGURE_ARGS+= --with-rlm_attr-rewrite
+else
+  CONFIGURE_ARGS+= --without-rlm_attr-rewrite
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius-mod-radutmp),)
+  CONFIGURE_ARGS+= --with-rlm_radutmp
+else
+  CONFIGURE_ARGS+= --without-rlm_radutmp
+endif
+
+CONFIGURE_VARS+= \
+       LDFLAGS="$$$$LDFLAGS -L$(PKG_INSTALL_DIR)/usr/lib/freeradius" \
+       LIBS="$(CONFIGURE_LIBS)" \
+       MYSQL_CONFIG="no" \
 
 define Build/Compile
-       rm -rf $(PKG_INSTALL_DIR)
-       mkdir -p $(PKG_INSTALL_DIR)
        $(MAKE) -C $(PKG_BUILD_DIR) \
                R="$(PKG_INSTALL_DIR)" \
                INSTALLSTRIP="" \
@@ -293,25 +325,27 @@ define Build/Compile
 endef
 
 define Package/freeradius/install
-       install -m0755 -d $(1)/etc/init.d
-       install -m0755 ./files/radiusd.init $(1)/etc/init.d/radiusd
-       install -m0755 -d $(1)/etc/freeradius
+       $(INSTALL_DIR) $(1)/etc/freeradius
        for f in clients.conf dictionary radiusd.conf; do \
                $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$${f} $(1)/etc/freeradius/ ; \
        done
-       install -m0755 -d $(1)/usr/share/freeradius
+       $(INSTALL_DIR) $(1)/usr/share/freeradius
        $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius/
-       for f in freeradius freeradius.internal rfc2865 rfc2866 rfc2867 rfc2868 rfc2869 rfc3162 rfc3576 rfc3580 microsoft wispr; do \
+       $(SED) "s,^\(\$$$$INCLUDE\),#\1,g" $(1)/usr/share/freeradius/dictionary
+       for f in $(PKG_DICTIONARIES); do \
                $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary.$$$${f} $(1)/usr/share/freeradius/ ; \
+               $(SED) "s,^#\(\$$$$INCLUDE dictionary\.$$$${f}\),\1,g" $(1)/usr/share/freeradius/dictionary ; \
        done
-       install -m0755 -d $(1)/usr/lib/freeradius
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/libradius{,-*}.so $(1)/usr/lib/freeradius/
-       install -m0755 -d $(1)/usr/sbin
-       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/freeradius
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/libradius{,-*}.so $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radiusd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/radiusd.init $(1)/etc/init.d/radiusd
 endef
 
 define Package/freeradius-democerts/install
-       install -m0755 -d $(1)/etc/freeradius
+       $(INSTALL_DIR) $(1)/etc/freeradius
        $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/certs $(1)/etc/freeradius/
        rm -rf $(1)/etc/freeradius/certs/README
        rm -rf $(1)/etc/freeradius/certs/new*
@@ -320,19 +354,19 @@ define Package/freeradius-democerts/install
 endef
 
 define Package/freeradius-utils/install
-       install -m0755 -d $(1)/usr/bin
-       for f in radclient; do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
+       $(INSTALL_DIR) $(1)/usr/bin
+       for f in radclient radeapclient; do \
+               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$$$${f} $(1)/usr/bin/ ; \
        done
 endef
 
 define BuildPlugin
   define Package/$(1)/install
-       [ -z "$(2)" ] || install -d -m0755 $$(1)/usr/lib/freeradius
+       [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib
        for m in $(2); do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/freeradius/ ; \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/ ; \
        done
-       [ -z "$(3)" ] || install -d -m0755 $$(1)/etc/freeradius
+       [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius
        for f in $(3); do \
                $(CP) $(PKG_INSTALL_DIR)/etc/freeradius/$$$$$$$${f} $$(1)/etc/freeradius/ ; \
        done
@@ -352,6 +386,8 @@ $(eval $(call BuildPlugin,freeradius-mod-eap-mschapv2,rlm_eap_mschapv2,))
 $(eval $(call BuildPlugin,freeradius-mod-eap-peap,rlm_eap_peap,))
 $(eval $(call BuildPlugin,freeradius-mod-eap-tls,rlm_eap_tls,))
 $(eval $(call BuildPlugin,freeradius-mod-eap-ttls,rlm_eap_ttls,))
+$(eval $(call BuildPlugin,freeradius-mod-exec,rlm_exec,))
+$(eval $(call BuildPlugin,freeradius-mod-attr-rewrite,rlm_attr_rewrite))
 $(eval $(call BuildPlugin,freeradius-mod-files,rlm_files,acct_users preproxy_users users))
 $(eval $(call BuildPlugin,freeradius-mod-ldap,rlm_ldap,ldap.attrmap))
 $(eval $(call BuildPlugin,freeradius-mod-mschap,rlm_mschap,))
@@ -362,4 +398,5 @@ $(eval $(call BuildPlugin,freeradius-mod-sql,rlm_sql,sql.conf))
 $(eval $(call BuildPlugin,freeradius-mod-sql-mysql,rlm_sql_mysql,))
 $(eval $(call BuildPlugin,freeradius-mod-sql-pgsql,rlm_sql_postgresql,))
 $(eval $(call BuildPlugin,freeradius-mod-sqlcounter,rlm_sqlcounter,))
+$(eval $(call BuildPlugin,freeradius-mod-radutmp,rlm_radutmp,))
 $(eval $(call BuildPackage,freeradius-utils))