-$(DL_DIR)/$(PKG_SOURCE_FILE):
- mkdir -p $(DL_DIR)
- $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) x $(PKG_SOURCE_SITE)
-
-$(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
- mkdir -p $(TOOL_BUILD_DIR)
- $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
- $(PATCH) $(PKG_BUILD_DIR) . $(PKG_NAME).patch
- touch $(PKG_BUILD_DIR)/.patched
-
-$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched
- (cd $(PKG_BUILD_DIR); \
- rm -f config.cache; \
- $(TARGET_CONFIGURE_OPTS) \
- CFLAGS="$(TARGET_CFLAGS)" \
- ./configure \
- --target=$(GNU_TARGET_NAME) \
- --host=$(GNU_TARGET_NAME) \
- --build=$(GNU_HOST_NAME) \
- --prefix=/usr \
- --exec-prefix=/usr \
- --bindir=/usr/bin \
- --datadir=/usr/share \
- --infodir=/usr/share/info \
- --libexecdir=/usr/lib \
- --localstatedir=/var \
- --mandir=/usr/share/man \
- --sbindir=/usr/sbin \
- --sysconfdir=/etc \
- $(DISABLE_NLS))
- touch $(PKG_BUILD_DIR)/.configured
-
-$(PKG_BUILD_DIR)/pppd/pppd $(PKG_BUILD_DIR)/pppd/plugins/radius/radius.so: $(PKG_BUILD_DIR)/.configured
- $(MAKE) -C $(PKG_BUILD_DIR) \
- CC=$(TARGET_CC) \
- COPTS="$(TARGET_CFLAGS)" \
- all
-
-$(PKG_PPP): $(PKG_BUILD_DIR)/pppd/pppd
- mkdir -p $(I_PPP)
- cp -af ./ipkg/ppp/* $(I_PPP)
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPP) control/ppp.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- mkdir -p $(I_PPP)/usr/sbin
- cp -af $(PKG_BUILD_DIR)/pppd/pppd $(I_PPP)/usr/sbin/
- $(STRIP) $(I_PPP)/usr/sbin/*
- mkdir -p $(I_PPP)/usr/lib/pppd
- cp $(PKG_BUILD_DIR)/pppd/plugins/*.so $(I_PPP)/usr/lib/pppd/
- $(STRIP) $(I_PPP)/usr/lib/pppd/*.so
- mkdir -p $(I_PPP)/$(MODULES_SUBDIR)
- cp $(MODULES_DIR)/kernel/drivers/net/ppp_async.o $(I_PPP)/$(MODULES_SUBDIR)
- cp $(MODULES_DIR)/kernel/drivers/net/ppp_deflate.o $(I_PPP)/$(MODULES_SUBDIR)
- cp $(MODULES_DIR)/kernel/drivers/net/bsd_comp.o $(I_PPP)/$(MODULES_SUBDIR)
- $(IPKG_BUILD) $(I_PPP) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/ppp.list: $(PKG_PPP)
- $(IPKG) install $(PKG_PPP)
-
-$(PKG_PPP_PPPOE_PLUGIN): $(PKG_PPP)
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPP_PPPOE_PLUGIN) control/ppp-pppoe-plugin.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- mkdir -p $(I_PPP_PPPOE_PLUGIN)/usr/lib/pppd/rp-pppoe
- cp -af $(PKG_BUILD_DIR)/pppd/plugins/rp-pppoe/rp-pppoe.so \
- $(I_PPP_PPPOE_PLUGIN)/usr/lib/pppd/rp-pppoe
- $(STRIP) $(I_PPP_PPPOE_PLUGIN)/usr/lib/pppd/*/*.so
- mkdir -p $(I_PPP_PPPOE_PLUGIN)/$(MODULES_SUBDIR)
- cp $(MODULES_DIR)/kernel/drivers/net/pppo*.o $(I_PPP_PPPOE_PLUGIN)/$(MODULES_SUBDIR)
- $(IPKG_BUILD) $(I_PPP_PPPOE_PLUGIN) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/ppp-pppoe-plugin.list: $(PKG_PPP_PPPOE_PLUGIN)
- $(IPKG) install $(PKG_PPP_PPPOE_PLUGIN)
-
-$(PKG_PPP_RADIUS_PLUGIN): $(PKG_PPP)
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPP_RADIUS_PLUGIN) control/ppp-radius-plugin.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- mkdir -p $(I_PPP_RADIUS_PLUGIN)/usr/lib/pppd/radius
- cp -af $(PKG_BUILD_DIR)/pppd/plugins/radius/radius.so \
- $(I_PPP_RADIUS_PLUGIN)/usr/lib/pppd/radius/
- $(STRIP) $(I_PPP_RADIUS_PLUGIN)/usr/lib/pppd/*/*.so
- $(IPKG_BUILD) $(I_PPP_RADIUS_PLUGIN) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/ppp-radius-plugin.list: $(PKG_PPP_RADIUS_PLUGIN)
- $(IPKG) install $(PKG_PPP_RADIUS_PLUGIN)
-
-$(PKG_PPPDUMP): $(PKG_PPP)
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPPDUMP) control/pppdump.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- mkdir -p $(I_PPPDUMP)/usr/sbin
- cp -af $(PKG_BUILD_DIR)/pppdump/pppdump $(I_PPPDUMP)/usr/sbin/
- $(STRIP) $(I_PPPDUMP)/usr/sbin/*
- $(IPKG_BUILD) $(I_PPPDUMP) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/pppdump.list: $(PKG_PPPDUMP)
- $(IPKG) install $(PKG_PPPDUMP)
-
-$(PKG_PPPSTATS): $(PKG_PPP)
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_PPPSTATS) control/pppstats.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- mkdir -p $(I_PPPSTATS)/usr/sbin
- cp -af $(PKG_BUILD_DIR)/pppstats/pppstats $(I_PPPSTATS)/usr/sbin/
- $(STRIP) $(I_PPPSTATS)/usr/sbin/*
- $(IPKG_BUILD) $(I_PPPSTATS) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/pppstats.list: $(PKG_PPPSTATS)
- $(IPKG) install $(PKG_PPPSTATS)
-
-source: $(DL_DIR)/$(PKG_SOURCE_FILE)
-prepare: $(PKG_BUILD_DIR)/.patched
-compile: $(TARGETS)
-install: $(INSTALL_TARGETS)
-
-clean:
- rm -rf $(PKG_BUILD_DIR)
- rm -f $(PKG_PPP) $(PKG_PPP_PPPOE_PLUGIN) $(PKG_PPP_RADIUS_PLUGIN) $(PKG_PPPSTATS) $(PKG_PPPDUMP)
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/include/pppd $(1)/usr/include/
+endef
+
+define Package/ppp/install
+ $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION)
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppd $(1)/usr/sbin/
+ $(INSTALL_DIR) $(1)/lib/network
+ $(INSTALL_BIN) ./files/ppp.sh $(1)/lib/network/
+ $(INSTALL_DIR) $(1)/etc/ppp
+ $(INSTALL_CONF) ./files/etc/ppp/chap-secrets $(1)/etc/ppp/
+ $(INSTALL_DATA) ./files/etc/ppp/filter $(1)/etc/ppp/
+ $(INSTALL_BIN) ./files/etc/ppp/ip-up $(1)/etc/ppp/
+ $(INSTALL_DIR) $(1)/etc/ppp/ip-up.d
+ $(INSTALL_BIN) ./files/etc/ppp/ip-down $(1)/etc/ppp/
+ $(INSTALL_DIR) $(1)/etc/ppp/ip-down.d
+ $(INSTALL_BIN) ./files/etc/ppp/ipv6-up $(1)/etc/ppp/
+ $(INSTALL_BIN) ./files/etc/ppp/ipv6-down $(1)/etc/ppp/
+ $(INSTALL_DATA) ./files/etc/ppp/options $(1)/etc/ppp/
+ ln -sf /tmp/resolv.conf.ppp $(1)/etc/ppp/resolv.conf
+endef
+Package/ppp-multilink/install=$(Package/ppp/install)
+
+define Package/ppp-mod-pppoa/install
+ $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION)
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/pppoatm.so \
+ $(1)/usr/lib/pppd/$(PKG_VERSION)/
+ $(INSTALL_DIR) $(1)/lib/network
+ $(INSTALL_BIN) ./files/pppoa.sh $(1)/lib/network/
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/atm
+ $(INSTALL_DATA) ./files/etc/hotplug.d/atm/20-atm-modem $(1)/etc/hotplug.d/atm/
+endef
+
+define Package/ppp-mod-pppoe/install
+ $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION)
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/rp-pppoe.so \
+ $(1)/usr/lib/pppd/$(PKG_VERSION)/
+ $(INSTALL_DIR) $(1)/lib/network
+ $(INSTALL_BIN) ./files/pppoe.sh $(1)/lib/network/
+endef
+
+define Package/ppp-mod-radius/install
+ $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION)
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/radius.so \
+ $(1)/usr/lib/pppd/$(PKG_VERSION)/
+ $(INSTALL_DIR) $(1)/etc/ppp
+ $(INSTALL_DATA) ./files/etc/ppp/radius.conf $(1)/etc/ppp/
+ $(INSTALL_DIR) $(1)/etc/ppp/radius
+ $(INSTALL_DATA) ./files/etc/ppp/radius/dictionary* \
+ $(1)/etc/ppp/radius/
+ $(INSTALL_CONF) ./files/etc/ppp/radius/servers \
+ $(1)/etc/ppp/radius/
+endef
+
+define Package/chat/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/chat $(1)/usr/sbin/
+endef
+
+define Package/pppdump/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppdump $(1)/usr/sbin/
+endef
+
+define Package/pppstats/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppstats $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ppp))
+$(eval $(call BuildPackage,ppp-multilink))
+$(eval $(call BuildPackage,ppp-mod-pppoa))
+$(eval $(call BuildPackage,ppp-mod-pppoe))
+$(eval $(call BuildPackage,ppp-mod-radius))
+$(eval $(call BuildPackage,chat))
+$(eval $(call BuildPackage,pppdump))
+$(eval $(call BuildPackage,pppstats))