--- /dev/null
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# This Makefile is a skeleton
+#
+# $Id: $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=
+PKG_VERSION:=
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=
+PKG_MD5SUM:=
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/package
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=package
+ URL:=
+endef
+
+define Package/package/description
+endef
+
+CONFIGURE_ARGS += \
+ --enable-static \
+ --enable-shared
+
+# If you wish to link against uclibc++ consider using the
+# following variables :
+CONFIGURE_VARS += \
+ CXXFLAGS="$$$$CXXFLAGS -fno-builtin -fno-rtti -nostdinc++" \
+ CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/uClibc++ -I$(LINUX_DIR)/include" \
+ LDFLAGS="$$$$LDFLAGS" \
+ LIBS="-nodefaultlibs -luClibc++ -lm -lnotimpl" \
+
+MAKE_FLAGS += \
+ CFLAGS="$(TARGET_CFLAGS)"
+
+
+define Build/Compile
+ # pass CFLAGS again to override -O2 set by configure
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ DESTDIR="$(PKG_INSTALL_DIR)" \
+ all install
+endef
+
+
+define Build/InstallDev
+ mkdir -p $(1)/usr/include/
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+ mkdir -p $(1)/usr/package
+ $(CP) $(PKG_INSTALL_DIR)/usr/package/package.{a,so*} $(1)/usr/package/
+endef
+
+define Build/UninstallDev
+ rm -rf $(1)/usr/include/package \
+ $(1)/usr/package/package.{a,so*}
+endef
+
+define Package/package/install
+ $(INSTALL_DIR) $(1)/usr/package
+ $(CP) $(PKG_INSTALL_DIR)/usr/package/package.so.* $(1)/usr/package/
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/package.init $(1)/etc/init.d/package
+ $(INSTALL_DIR) $(1)/etc/config/
+ $(INSTALL_CONF) $(1)/etc/config/package
+endef
+
+$(eval $(call BuildPackage,package))
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Sample init script reading its
+# configuration from /etc/config/package
+START=46
+STOP=46
+
+start_service() {
+ local section="$1"
+
+ include /lib/network
+ scan_interfaces
+ config_load /var/state/network
+
+ config_get LAN lan ifname
+ config_get option1 "$section" option1
+ config_get option2 "$section" option2
+
+ # Do some action with the variables
+ echo "option1 = $option1"
+}
+
+stop_service() {
+ local section="$1"
+
+ include /lib/network
+ scan_interfaces
+ config_load /var/state/network
+
+ config_get LAN lan ifname
+ config_get option1 "$section" option1
+ config_get option2 "$section" option2
+}
+start() {
+ # Do some optionnal testing
+ # before starting the program
+ config_load "package"
+ config_foreach start_service package
+}
+
+stop () {
+ config_load "package"
+ config_foreach stop_service package
+}