packages/openl2tp: enable config file support (thanks to Bogdan Roman), provide -full & -mini variants (closes: #10164)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@28758 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2011-11-04 23:28:07 +00:00
parent b511f9d210
commit 07a3a1c232
3 changed files with 109 additions and 47 deletions

View 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. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -10,34 +10,30 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=openl2tp PKG_NAME:=openl2tp
PKG_VERSION:=1.8 PKG_VERSION:=1.8
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/openl2tp PKG_SOURCE_URL:=@SF/openl2tp
PKG_MD5SUM:=e3d08dedfb9e6a9a1e24f6766f6dadd0 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 PKG_BUILD_PARALLEL:=1
PPPD_VERSION:=2.4.5 PPPD_VERSION:=2.4.5
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
define Build/Prepare define Package/openl2tp/Default
$(call Build/Prepare/Default) SUBMENU:=VPN
$(CP) ./src/*.[ch] $(PKG_BUILD_DIR)/
endef
define Package/openl2tp
SECTION:=net SECTION:=net
CATEGORY:=Network CATEGORY:=Network
DEPENDS:=+ppp +kmod-pppol2tp +portmap +libreadline +libncurses \
@!LINUX_2_4 $(LIBRPC_DEPENDS)
TITLE:=An L2TP (Layer 2 Tunneling Protocol) daemon TITLE:=An L2TP (Layer 2 Tunneling Protocol) daemon
URL:=http://www.openl2tp.org/ URL:=http://www.openl2tp.org/
SUBMENU:=VPN PROVIDES:=openl2tp
DEPENDS:=+ppp +kmod-pppol2tp
endef endef
define Package/openl2tp/description define Package/openl2tp/description/Default
OpenL2TP is an open source L2TP client/server, written by Katalix Systems OpenL2TP is an open source L2TP client/server, written by Katalix Systems
specifically for Linux. It has been designed for use as an enterprise specifically for Linux. It has been designed for use as an enterprise
L2TP VPN server or in commercial, Linux-based, embedded networking L2TP VPN server or in commercial, Linux-based, embedded networking
@ -45,6 +41,34 @@ define Package/openl2tp/description
configuration. configuration.
endef 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+= \ MAKE_FLAGS+= \
KERNEL_SRCDIR="$(LINUX_DIR)" \ KERNEL_SRCDIR="$(LINUX_DIR)" \
KERNEL_BLDDIR="$(LINUX_DIR)" \ KERNEL_BLDDIR="$(LINUX_DIR)" \
@ -52,10 +76,32 @@ MAKE_FLAGS+= \
READLINE_DIR="$(STAGING_DIR)/usr" \ READLINE_DIR="$(STAGING_DIR)/usr" \
PPPD_SRCDIR="$(STAGING_DIR)/usr/include" \ PPPD_SRCDIR="$(STAGING_DIR)/usr/include" \
PPPD_LIBDIR="$(STAGING_DIR)/usr/lib" \ PPPD_LIBDIR="$(STAGING_DIR)/usr/lib" \
CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ CFLAGS.optimize="$(TARGET_CFLAGS)" \
LIBS.dmalloc="-L$(STAGING_DIR)/usr/lib $(LIBRPC)" CPPFLAGS-y="-I$(STAGING_DIR)/usr/include" \
L2TP_FEATURE_LOCAL_CONF_FILE=y \
define Package/openl2tp/install ifeq ($(BUILD_VARIANT),full)
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_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/l2tpconfig $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/l2tpconfig $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/sbin $(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/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ppp_unix.so $(1)/usr/lib/openl2tp/
endef 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))

View File

@ -1,35 +1,5 @@
--- a/Makefile --- a/Makefile
+++ b/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 @@ -158,7 +158,7 @@ CFLAGS= -I. -Iusl -Icli -isystem inclu
$(CPPFLAGS) $(CPPFLAGS.dmalloc) \ $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
-DSYS_LIBDIR=$(SYS_LIBDIR) -DSYS_LIBDIR=$(SYS_LIBDIR)
@ -63,6 +33,19 @@
$(MAKE) -C $(@:subdir-%=%) $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" $(MAKE) -C $(@:subdir-%=%) $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)"
ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y) 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: @@ -265,9 +265,13 @@ TAGS:
@for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; done @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; done
etags $(wildcard *.c) $(wildcard *.h) etags $(wildcard *.c) $(wildcard *.h)

View File

@ -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$@ $<