[packages] freeradius2: Package rlm_always (#8291)
[openwrt/svn-archive/archive.git] / net / freeradius2 / Makefile
index 382e878..dba08f4 100644 (file)
@@ -1,29 +1,29 @@
-# 
-# Copyright (C) 2008 OpenWrt.org
+#
+# Copyright (C) 2008-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:=freeradius2
-PKG_VERSION:=2.1.1
-PKG_RELEASE:=2
+PKG_VERSION:=2.1.9
+PKG_RELEASE:=4
 
 PKG_SOURCE:=freeradius-server-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=ftp://ftp.freeradius.org/pub/freeradius/
-PKG_MD5SUM:=4ccf748ef9851d90844d085647351ca4
+PKG_MD5SUM:=5e16a0869acdf448b191c7e30f6507d8
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/freeradius-server-$(PKG_VERSION)
+PKG_FIXUP:=libtool
 
 include $(INCLUDE_DIR)/package.mk
 
 define Package/freeradius2/Default
   SECTION:=net
   CATEGORY:=Network
-  URL:=http://www.freeradius2.org/
+  URL:=http://freeradius.org/
 endef
 
 define Package/freeradius2
@@ -36,6 +36,7 @@ endef
 define Package/freeradius2/conffiles
 /etc/freeradius2/clients.conf
 /etc/freeradius2/radiusd.conf
+/etc/freeradius2/sites/default
 endef
 
 define Package/freeradius2-democerts
@@ -50,12 +51,20 @@ define Package/freeradius2-mod-chap
   TITLE:=CHAP module
 endef
 
+define Package/freeradius2-mod-chap/conffiles
+/etc/freeradius2/modules/chap
+endef
+
 define Package/freeradius2-mod-detail
   $(call Package/freeradius2/Default)
   DEPENDS:=freeradius2
   TITLE:=Detailed accounting module
 endef
 
+define Package/freeradius2-mod-detail/conffiles
+/etc/freeradius2/modules/detail
+endef
+
 define Package/freeradius2-mod-eap
   $(call Package/freeradius2/Default)
   DEPENDS:=freeradius2
@@ -108,12 +117,64 @@ define Package/freeradius2-mod-exec
   TITLE:=EXEC module
 endef
 
+define Package/freeradius2-mod-exec/conffiles
+/etc/freeradius2/modules/exec
+endef
+
+define Package/freeradius2-mod-expiration
+  $(call Package/freeradius2/Default)
+  DEPENDS:=freeradius2
+  TITLE:=Expiration module
+endef
+
+define Package/freeradius2-mod-expiration/conffiles
+/etc/freeradius2/modules/expiration
+endef
+
+define Package/freeradius2-mod-always
+  $(call Package/freeradius2/Default)
+  DEPENDS:=freeradius2
+  TITLE:=Always module
+endef
+
+define Package/freeradius2-mod-always/conffiles
+/etc/freeradius2/modules/always
+endef
+
+define Package/freeradius2-mod-expr
+  $(call Package/freeradius2/Default)
+  DEPENDS:=freeradius2
+  TITLE:=EXPR module
+endef
+
+define Package/freeradius2-mod-expr/conffiles
+/etc/freeradius2/modules/expr
+endef
+
+define Package/freeradius2-mod-attr-filter
+  $(call Package/freeradius2/Default)
+  DEPENDS:=freeradius2
+  TITLE:=ATTR filter module
+endef
+
+define Package/freeradius2-mod-attr-filter/conffiles
+/etc/freeradius2/modules/attr_filter
+/etc/freeradius2/attrs
+/etc/freeradius2/attrs.access_reject
+/etc/freeradius2/attrs.accounting_response
+/etc/freeradius2/attrs.pre-proxy
+endef
+
 define Package/freeradius2-mod-attr-rewrite
   $(call Package/freeradius2/Default)
   DEPENDS:=freeradius2
   TITLE:=ATTR rewrite module
 endef
 
+define Package/freeradius2-mod-attr-rewrite/conffiles
+/etc/freeradius2/modules/attr_rewrite
+endef
+
 define Package/freeradius2-mod-files
   $(call Package/freeradius2/Default)
   DEPENDS:=freeradius2
@@ -124,6 +185,7 @@ define Package/freeradius2-mod-files/conffiles
 /etc/freeradius2/acct_users
 /etc/freeradius2/preproxy_users
 /etc/freeradius2/users
+/etc/freeradius2/modules/files
 endef
 
 define Package/freeradius2-mod-ldap
@@ -134,6 +196,17 @@ endef
 
 define Package/freeradius2-mod-ldap/conffiles
 /etc/freeradius2/ldap.attrmap
+/etc/freeradius2/modules/ldap
+endef
+
+define Package/freeradius2-mod-logintime
+  $(call Package/freeradius2/Default)
+  DEPENDS:=freeradius2
+  TITLE:=Logintime module
+endef
+
+define Package/freeradius2-mod-logintime/conffiles
+/etc/freeradius2/modules/logintime
 endef
 
 define Package/freeradius2-mod-mschap
@@ -142,12 +215,20 @@ define Package/freeradius2-mod-mschap
   TITLE:=MS-CHAP and MS-CHAPv2 module
 endef
 
+define Package/freeradius2-mod-mschap/conffiles
+/etc/freeradius2/modules/mschap
+endef
+
 define Package/freeradius2-mod-pap
   $(call Package/freeradius2/Default)
   DEPENDS:=freeradius2
   TITLE:=PAP module
 endef
 
+define Package/freeradius2-mod-pap/conffiles
+/etc/freeradius2/modules/pap
+endef
+
 define Package/freeradius2-mod-preprocess
   $(call Package/freeradius2/Default)
   DEPENDS:=freeradius2
@@ -157,6 +238,7 @@ endef
 define Package/freeradius2-mod-preprocess/conffiles
 /etc/freeradius2/hints
 /etc/freeradius2/huntgroups
+/etc/freeradius2/modules/preprocess
 endef
 
 define Package/freeradius2-mod-realm
@@ -167,6 +249,7 @@ endef
 
 define Package/freeradius2-mod-realm/conffiles
 /etc/freeradius2/proxy.conf
+/etc/freeradius2/modules/realm
 endef
 
 define Package/freeradius2-mod-sql
@@ -175,15 +258,21 @@ define Package/freeradius2-mod-sql
   TITLE:=Base SQL module
 endef
 
+define Package/freeradius2-mod-sql/conffiles
+/etc/freeradius2/sql.conf
+endef
+
 define Package/freeradius2-mod-sql-mysql
   $(call Package/freeradius2/Default)
-  DEPENDS:=freeradius2-mod-sql +libmysqlclient
+  DEPENDS:=freeradius2-mod-sql \
+       +PACKAGE_freeradius2-mod-sql-mysql:libmysqlclient
   TITLE:=MySQL module
 endef
 
 define Package/freeradius2-mod-sql-pgsql
   $(call Package/freeradius2/Default)
-  DEPENDS:=freeradius2-mod-sql +libpq
+  DEPENDS:=freeradius2-mod-sql \
+       +PACKAGE_freeradius2-mod-sql-pgsql:libpq
   TITLE:=PostgreSQL module
 endef
 
@@ -199,6 +288,11 @@ define Package/freeradius2-mod-radutmp
   TITLE:=Radius UTMP module
 endef
 
+define Package/freeradius2-mod-radutmp/conffiles
+/etc/freeradius2/modules/radutmp
+/etc/freeradius2/modules/sradutmp
+endef
+
 define Package/freeradius2-utils
   $(call Package/freeradius2/Default)
   DEPENDS:=freeradius2
@@ -211,25 +305,33 @@ CONFIGURE_ARGS+= \
        --enable-shared \
        --disable-static \
        --disable-developer \
+       --with-threads \
        --with-openssl-includes="$(STAGING_DIR)/usr/include" \
        --with-openssl-libraries="$(STAGING_DIR)/usr/lib" \
+       --with-system-libtool \
+       --with-system-libltdl \
        --enable-strict-dependencies \
        --with-raddbdir=/etc/freeradius2 \
+       --with-radacctdir=/var/db/radacct \
+       --with-logdir=/var/log \
        --without-edir \
        --without-snmp \
        --without-rlm_checkval \
-       --without-rlm_counter \
        --without-rlm_dbm \
+       --without-rlm_counter \
+       --with-rlm_expr \
        --with-rlm_eap \
        --without-rlm_eap_sim \
        --without-rlm_example \
        --without-rlm_ippool \
        --without-rlm_krb5 \
        --without-rlm_otp \
+       --without-rlm_smsotp \
        --without-rlm_pam \
        --without-rlm_perl \
        --without-rlm_python \
        --without-rlm_smb \
+       --without-rlm_always \
        --with-rlm_sql \
        --with-rlm_sqlcounter \
        --without-rlm_sqlhpwippool \
@@ -268,9 +370,9 @@ endif
 ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-sql-mysql),)
   CONFIGURE_ARGS+= \
                --with-mysql-include-dir="$(STAGING_DIR)/usr/include" \
-               --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql" \
-               --without-threads
+               --with-mysql-lib-dir="$(STAGING_DIR)/usr/lib/mysql"
   CONFIGURE_LIBS+= -lz
+  CONFIGURE_VARS+= ac_cv_lib_mysqlclient_r_mysql_init=yes
 else
   CONFIGURE_ARGS+= --without-rlm_sql_mysql
 endif
@@ -325,6 +427,24 @@ else
   CONFIGURE_ARGS+= --without-rlm_radutmp
 endif
 
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-logintime),)
+  CONFIGURE_ARGS+= --with-rlm_logintime
+else
+  CONFIGURE_ARGS+= --without-rlm_logintime
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-expiration),)
+  CONFIGURE_ARGS+= --with-rlm_expiration
+else
+  CONFIGURE_ARGS+= --without-rlm_expiration
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_freeradius2-mod-always),)
+  CONFIGURE_ARGS+= --with-rlm_always
+else
+  CONFIGURE_ARGS+= --without-rlm_always
+endif
+
 CONFIGURE_VARS+= \
        LDFLAGS="$$$$LDFLAGS" \
        LIBS="$(CONFIGURE_LIBS)" \
@@ -335,14 +455,18 @@ define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR) \
                R="$(PKG_INSTALL_DIR)" \
                INSTALLSTRIP="" \
-               all install
+               all certs install
 endef
 
 define Package/freeradius2/install
        $(INSTALL_DIR) $(1)/etc/freeradius2
-       for f in clients.conf dictionary radiusd.conf; do \
+       $(INSTALL_DIR) $(1)/etc/freeradius2/modules
+       $(INSTALL_DIR) $(1)/etc/freeradius2/sites
+       chmod 771 $(1)/etc/freeradius2
+       for f in clients.conf dictionary radiusd.conf policy.conf; do \
                $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$${f} $(1)/etc/freeradius2/ ; \
        done
+       $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/sites-available/default $(1)/etc/freeradius2/sites/default
        $(INSTALL_DIR) $(1)/usr/share/freeradius2
        $(CP) $(PKG_INSTALL_DIR)/usr/share/freeradius/dictionary $(1)/usr/share/freeradius2/
        $(SED) "s,^\(\$$$$INCLUDE\),#\1,g" $(1)/usr/share/freeradius2/dictionary
@@ -351,7 +475,9 @@ define Package/freeradius2/install
                $(SED) "s,^#\(\$$$$INCLUDE dictionary\.$$$${f}\),\1,g" $(1)/usr/share/freeradius2/dictionary ; \
        done
        $(INSTALL_DIR) $(1)/usr/lib/freeradius2
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/libfreeradius-radius{,-*}.so $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/libfreeradius-radius{,-*}.so $(1)/usr/lib/freeradius2
+       ln -s freeradius2/libfreeradius-radius-$(PKG_VERSION).so $(1)/usr/lib/
+       ln -s freeradius2/libfreeradius-eap-$(PKG_VERSION).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
@@ -359,12 +485,13 @@ define Package/freeradius2/install
 endef
 
 define Package/freeradius2-democerts/install
-       $(INSTALL_DIR) $(1)/etc/freeradius2
-       $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/certs $(1)/etc/freeradius2/
-       rm -rf $(1)/etc/freeradius2/certs/README
-       rm -rf $(1)/etc/freeradius2/certs/new*
-       rm -rf $(1)/etc/freeradius2/certs/demoCA/index*
-       rm -rf $(1)/etc/freeradius2/certs/demoCA/serial*
+       $(INSTALL_DIR) $(1)/etc/freeradius2/certs
+       $(CP) \
+               $(PKG_BUILD_DIR)/raddb/certs/ca.pem \
+               $(PKG_BUILD_DIR)/raddb/certs/dh \
+               $(PKG_BUILD_DIR)/raddb/certs/random \
+               $(PKG_BUILD_DIR)/raddb/certs/server.pem \
+               $(1)/etc/freeradius2/certs/
 endef
 
 define Package/freeradius2-utils/install
@@ -376,13 +503,14 @@ endef
 
 define BuildPlugin
   define Package/$(1)/install
-       [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib
+       [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/freeradius2
        for m in $(2); do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/ ; \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/freeradius2/$$$$$$$${m}{,-*}.so $$(1)/usr/lib/freeradius2 ; \
        done
        [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius2
+       [ -z "$(4)" ] || $(INSTALL_DIR) $$(1)/etc/freeradius2/$(4)
        for f in $(3); do \
-               $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$$$$$${f} $$(1)/etc/freeradius2/ ; \
+               $(CP) $(PKG_INSTALL_DIR)/etc/freeradius2/$$$$$$$${f} $$(1)/etc/freeradius2/$$$$$$$${f} ; \
        done
   endef
 
@@ -391,8 +519,8 @@ endef
 
 $(eval $(call BuildPackage,freeradius2))
 $(eval $(call BuildPackage,freeradius2-democerts))
-$(eval $(call BuildPlugin,freeradius2-mod-chap,rlm_chap,))
-$(eval $(call BuildPlugin,freeradius2-mod-detail,rlm_detail,))
+$(eval $(call BuildPlugin,freeradius2-mod-chap,rlm_chap,modules/chap,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-detail,rlm_detail,modules/detail,modules,))
 $(eval $(call BuildPlugin,freeradius2-mod-eap,libfreeradius-eap rlm_eap,eap.conf))
 $(eval $(call BuildPlugin,freeradius2-mod-eap-gtc,rlm_eap_gtc,))
 $(eval $(call BuildPlugin,freeradius2-mod-eap-md5,rlm_eap_md5,))
@@ -400,17 +528,22 @@ $(eval $(call BuildPlugin,freeradius2-mod-eap-mschapv2,rlm_eap_mschapv2,))
 $(eval $(call BuildPlugin,freeradius2-mod-eap-peap,rlm_eap_peap,))
 $(eval $(call BuildPlugin,freeradius2-mod-eap-tls,rlm_eap_tls,))
 $(eval $(call BuildPlugin,freeradius2-mod-eap-ttls,rlm_eap_ttls,))
-$(eval $(call BuildPlugin,freeradius2-mod-exec,rlm_exec,))
-$(eval $(call BuildPlugin,freeradius2-mod-attr-rewrite,rlm_attr_rewrite))
-$(eval $(call BuildPlugin,freeradius2-mod-files,rlm_files,acct_users preproxy_users users))
-$(eval $(call BuildPlugin,freeradius2-mod-ldap,rlm_ldap,ldap.attrmap))
-$(eval $(call BuildPlugin,freeradius2-mod-mschap,rlm_mschap,))
-$(eval $(call BuildPlugin,freeradius2-mod-pap,rlm_pap,))
-$(eval $(call BuildPlugin,freeradius2-mod-preprocess,rlm_preprocess,hints huntgroups))
-$(eval $(call BuildPlugin,freeradius2-mod-realm,rlm_realm,proxy.conf))
-$(eval $(call BuildPlugin,freeradius2-mod-sql,rlm_sql,sql.conf))
+$(eval $(call BuildPlugin,freeradius2-mod-exec,rlm_exec,modules/exec modules/echo ,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-attr-rewrite,rlm_attr_rewrite,modules/attr_rewrite,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-files,rlm_files,acct_users preproxy_users users modules/files,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-ldap,rlm_ldap,ldap.attrmap modules/ldap,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-mschap,rlm_mschap,modules/mschap,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-pap,rlm_pap,modules/pap,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-preprocess,rlm_preprocess,hints huntgroups modules/preprocess,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-realm,rlm_realm,proxy.conf modules/realm modules/inner-eap,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-sql,rlm_sql,sql.conf,))
 $(eval $(call BuildPlugin,freeradius2-mod-sql-mysql,rlm_sql_mysql,))
 $(eval $(call BuildPlugin,freeradius2-mod-sql-pgsql,rlm_sql_postgresql,))
 $(eval $(call BuildPlugin,freeradius2-mod-sqlcounter,rlm_sqlcounter,))
-$(eval $(call BuildPlugin,freeradius2-mod-radutmp,rlm_radutmp,))
+$(eval $(call BuildPlugin,freeradius2-mod-radutmp,rlm_radutmp,modules/radutmp modules/sradutmp,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-logintime,rlm_logintime,modules/logintime,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-expr,rlm_expr,modules/expr,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-attr-filter,rlm_attr_filter,modules/attr_filter attrs attrs.access_reject attrs.accounting_response attrs.pre-proxy,modules,,))
+$(eval $(call BuildPlugin,freeradius2-mod-expiration,rlm_expiration,modules/expiration,modules,))
+$(eval $(call BuildPlugin,freeradius2-mod-always,rlm_always,modules/always,modules,))
 $(eval $(call BuildPackage,freeradius2-utils))