packages/openl2tp: enable config file support (thanks to Bogdan Roman), provide ...
authorNicolas Thill <nico@openwrt.org>
Fri, 4 Nov 2011 23:28:07 +0000 (23:28 +0000)
committerNicolas Thill <nico@openwrt.org>
Fri, 4 Nov 2011 23:28:07 +0000 (23:28 +0000)
SVN-Revision: 28758

net/openl2tp/Makefile
net/openl2tp/patches/001-makefile.patch
net/openl2tp/patches/002-no_libfl.patch [new file with mode: 0644]

index 017b044f590a04afe7d9a5ccb3ba31f026d96436..a263e1a804610f01757d05edd9369391794b30d2 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2009-2010 OpenWrt.org
+# Copyright (C) 2009-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -10,34 +10,30 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=openl2tp
 PKG_VERSION:=1.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/openl2tp
 PKG_MD5SUM:=e3d08dedfb9e6a9a1e24f6766f6dadd0
 
-PKG_BUILD_DEPENDS:=libreadline libncurses
+PKG_BUILD_DEPENDS:=libreadline libncurses USE_UCLIBC:librpc
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_BUILD_PARALLEL:=1
 PPPD_VERSION:=2.4.5
 
 include $(INCLUDE_DIR)/package.mk
 
-define Build/Prepare
-       $(call Build/Prepare/Default)
-       $(CP) ./src/*.[ch] $(PKG_BUILD_DIR)/
-endef
-
-define Package/openl2tp
+define Package/openl2tp/Default
+  SUBMENU:=VPN
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+ppp +kmod-pppol2tp +portmap +libreadline +libncurses \
-       @!LINUX_2_4 $(LIBRPC_DEPENDS)
   TITLE:=An L2TP (Layer 2 Tunneling Protocol) daemon
   URL:=http://www.openl2tp.org/
-  SUBMENU:=VPN
+  PROVIDES:=openl2tp
+  DEPENDS:=+ppp +kmod-pppol2tp
 endef
 
-define Package/openl2tp/description
+define Package/openl2tp/description/Default
  OpenL2TP is an open source L2TP client/server, written by Katalix Systems
  specifically for Linux. It has been designed for use as an enterprise 
  L2TP VPN server or in commercial, Linux-based, embedded networking
@@ -45,6 +41,34 @@ define Package/openl2tp/description
  configuration.
 endef
 
+
+define Package/openl2tp-full
+$(call Package/openl2tp/Default)
+  TITLE+=(full)
+  VARIANT:=full
+  DEPENDS+=+portmap +libreadline +libncurses $(LIBRPC_DEPENDS)
+endef
+
+define Package/openl2tp-full/description
+$(call Package/openl2tp/description/Default)
+ .
+ This package a full-featured, RPC-enabled OpenL2TP.
+endef
+
+
+define Package/openl2tp-mini
+$(call Package/openl2tp/Default)
+  TITLE+=(mini)
+  VARIANT:=mini
+endef
+
+define Package/openl2tp-mini/description
+$(call Package/openl2tp/description/Default)
+ .
+ This package a minimal-featured, RPC-disabled OpenL2TP.
+endef
+
+
 MAKE_FLAGS+= \
        KERNEL_SRCDIR="$(LINUX_DIR)" \
        KERNEL_BLDDIR="$(LINUX_DIR)" \
@@ -52,10 +76,32 @@ MAKE_FLAGS+= \
        READLINE_DIR="$(STAGING_DIR)/usr" \
        PPPD_SRCDIR="$(STAGING_DIR)/usr/include" \
        PPPD_LIBDIR="$(STAGING_DIR)/usr/lib" \
-       CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
-       LIBS.dmalloc="-L$(STAGING_DIR)/usr/lib $(LIBRPC)"
+       CFLAGS.optimize="$(TARGET_CFLAGS)" \
+       CPPFLAGS-y="-I$(STAGING_DIR)/usr/include" \
+       L2TP_FEATURE_LOCAL_CONF_FILE=y \
+
+ifeq ($(BUILD_VARIANT),full)
 
-define Package/openl2tp/install
+  MAKE_FLAGS += \
+       L2TP_FEATURE_RPC_MANAGEMENT=y \
+       L2TP_FEATURE_LOCAL_STAT_FILE=y \
+       LIBS.dmalloc="-L$(STAGING_DIR)/usr/lib $(LIBRPC)" \
+
+endif
+ifeq ($(BUILD_VARIANT),mini)
+
+  MAKE_FLAGS += \
+       L2TP_FEATURE_RPC_MANAGEMENT= \
+       L2TP_FEATURE_LOCAL_STAT_FILE= \
+
+endif
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(CP) ./src/*.[ch] $(PKG_BUILD_DIR)/
+endef
+
+define Package/openl2tp-full/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/l2tpconfig  $(1)/usr/bin/
        $(INSTALL_DIR) $(1)/usr/sbin
@@ -70,4 +116,15 @@ define Package/openl2tp/install
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ppp_unix.so $(1)/usr/lib/openl2tp/
 endef
 
-$(eval $(call BuildPackage,openl2tp))
+define Package/openl2tp-mini/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/openl2tpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PPPD_VERSION)
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/pppd/pppol2tp.so $(1)/usr/lib/pppd/$(PPPD_VERSION)/
+       $(INSTALL_DIR) $(1)/usr/lib/openl2tp
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ipsec.so $(1)/usr/lib/openl2tp/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ppp_unix.so $(1)/usr/lib/openl2tp/
+endef
+
+$(eval $(call BuildPackage,openl2tp-full))
+$(eval $(call BuildPackage,openl2tp-mini))
index 17790cfbdab78fc4cadbfc8a3142ddb6b8aaaffb..cae8e8e213aa6997092e3f7e3dcc63753dc0c369 100644 (file)
@@ -1,35 +1,5 @@
 --- a/Makefile
 +++ b/Makefile
-@@ -8,7 +8,7 @@ L2TP_FEATURE_LAIC_SUPPORT=     y
- L2TP_FEATURE_LAOC_SUPPORT=    y
- L2TP_FEATURE_LNIC_SUPPORT=    y
- L2TP_FEATURE_LNOC_SUPPORT=    y
--L2TP_FEATURE_LOCAL_CONF_FILE= y
-+#L2TP_FEATURE_LOCAL_CONF_FILE=        y
- #L2TP_FEATURE_LOCAL_STAT_FILE=        y
- # Define USE_DMALLOC to enable dmalloc memory debugging
-@@ -55,17 +55,17 @@ endif
- # in the pppd subdirectory of the compiler's default search path
- # (e.g. /usr/include/pppd). but can be pointed to another directory if
- # desired.
--PPPD_VERSION=         2.4.5
-+#PPPD_VERSION=                2.4.5
- # PPPD_INCDIR=                /usr/include/pppd
- # PPPD_LIBDIR=                $(SYS_LIBDIR)/pppd/$(PPPD_VERSION)
- # Points to readline install root. READLINE_DIR should have lib/ &
- # include/ subdirs If not defined, readline is assumed to be installed
- # in the standard places that the compiler looks.
--READLINE_DIR=         
-+#READLINE_DIR=                
- # For cross-compiling
--CROSS_COMPILE=
-+#CROSS_COMPILE=
- # END CONFIGURABLE SETTINGS
 @@ -158,7 +158,7 @@ CFLAGS=                    -I. -Iusl -Icli -isystem inclu
                                $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
                                -DSYS_LIBDIR=$(SYS_LIBDIR)
                        $(MAKE) -C $(@:subdir-%=%) $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)"
  
  ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y)
+@@ -212,10 +212,10 @@ LDFLAGS.l2tpd+=          -lfl
+                       $(YACC) -d -o l2tp_config_parse.c $<
+ l2tp_config_token.o:  l2tp_config_token.c
+-                      $(CC) -I. -MMD -w $(CFLAGS.optimize) -c -DYY_NO_UNPUT $<
++                      $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) -DYY_NO_UNPUT $<
+ l2tp_config_parse.o:  l2tp_config_parse.c l2tp_config_parse.h
+-                      $(CC) -I. -MMD -w $(CFLAGS.optimize) -c -DYY_NO_UNPUT $<
++                      $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) -DYY_NO_UNPUT $<
+ endif
+ # Compile without -Wall because rpcgen-generated code is full of warnings.
 @@ -265,9 +265,13 @@ TAGS:
                        @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; done
                        etags $(wildcard *.c) $(wildcard *.h)
diff --git a/net/openl2tp/patches/002-no_libfl.patch b/net/openl2tp/patches/002-no_libfl.patch
new file mode 100644 (file)
index 0000000..ae1dc6a
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/l2tp_config_token.l
++++ b/l2tp_config_token.l
+@@ -23,6 +23,8 @@ static int resolveip(const char *val, st
+ int lineno;
+ int command;
++int yywrap(void) { return 1; }
++
+ %}
+ /* common section */
+--- a/Makefile
++++ b/Makefile
+@@ -204,7 +204,7 @@ ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y)
+ # Config file parser
+ LEX=                  flex
+ YACC=                 bison
+-LDFLAGS.l2tpd+=               -lfl
++LDFLAGS.l2tpd+=
+ %.c:  %.l
+                       $(LEX) -o$@ $<