Add some skeletons for Makefile, init script and config file
git-svn-id: svn://svn.openwrt.org/openwrt/packages@9780 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
5149bd6e63
commit
89fd0dd8d5
81
skels/Makefile
Normal file
81
skels/Makefile
Normal file
@ -0,0 +1,81 @@
|
||||
#
|
||||
# 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))
|
4
skels/files/package.conf
Normal file
4
skels/files/package.conf
Normal file
@ -0,0 +1,4 @@
|
||||
# Sample configuration file
|
||||
config package
|
||||
option option1 'some default value'
|
||||
option option2 ''
|
43
skels/files/package.init
Executable file
43
skels/files/package.init
Executable file
@ -0,0 +1,43 @@
|
||||
#!/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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user