packages/rrdcollect: fix linking against rrdtool by splitting it into 2 packages

* rrdcollect10, linked against rrdtool-1.0.x shared library
 * rrdcollect12, linked against rrdtool-1.2.x shared library
 * use new service functions

git-svn-id: svn://svn.openwrt.org/openwrt/packages@28957 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2011-11-11 18:06:52 +00:00
parent 9982f046e1
commit 4b84fa92c1
2 changed files with 88 additions and 29 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2009 OpenWrt.org
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,12 +9,14 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=rrdcollect
PKG_VERSION:=0.2.4
PKG_RELEASE:=1
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/rrdcollect
PKG_MD5SUM:=fd7ac95195e3e5cbab0677629505d9be
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
@ -33,52 +35,107 @@ define Package/rrdcollect/Default/description
pattern matches and perl compatible regular expressions.
endef
define Package/rrdcollect
define Package/rrdcollect10
$(call Package/rrdcollect/Default)
DEPENDS:=+librrd1
TITLE:=Round-Robin Database (RRD) collecting daemon
MENU:=1
PROVIDES:=rrdcollect
DEPENDS:=+librrd1
VARIANT:=rrdtool10
endef
define Package/rrdcollect/description
define Package/rrdcollect10/description
$(call Package/rrdcollect/Default/description)
This package contains the RRD collecting daemon.
.
This package contains the RRD collecting daemon, linked against
rrdtool-1.0.x shared library.
endef
define Package/rrdcollect-example
define Package/rrdcollect12
$(call Package/rrdcollect/Default)
DEPENDS:=rrdcollect
TITLE:=Example setup for RRD collecting daemon above
TITLE:=Round-Robin Database (RRD) collecting daemon
PROVIDES:=rrdcollect
DEPENDS:=+librrd
VARIANT:=rrdtool12
endef
define Package/rrdcollect-example/description
define Package/rrdcollect12/description
$(call Package/rrdcollect/Default/description)
This package contains examples for the RRD collecting daemon.
.
This package contains the RRD collecting daemon, linked against
rrdtool-1.2.x shared library.
endef
define Package/rrdcollect-example/conffiles
/etc/rrd.conf
/etc/rrdcollect.conf
define Package/rrdcollect10-example
$(call Package/rrdcollect/Default)
TITLE:=Example setup for RRD collecting daemon above
DEPENDS:=rrdcollect +rrdtool1
VARIANT:=rrdtool12
endef
define Package/rrdcollect10-example/description
$(call Package/rrdcollect/Default/description)
.
This package contains examples for the RRD collecting daemon, using
rrdtool-1.0.x shared library and utilities.
endef
define Package/rrdcollect12-example
$(call Package/rrdcollect/Default)
TITLE:=Example setup for RRD collecting daemon above
DEPENDS:=rrdcollect +rrdtool
VARIANT:=rrdtool12
endef
define Package/rrdcollect12-example/description
$(call Package/rrdcollect/Default/description)
This package contains examples for the RRD collecting daemon, using
rrdtool-1.2.x shared library and utilities.
endef
CONFIGURE_ARGS+= \
--enable-shared \
--disable-static \
--disable-rpath \
--enable-exec \
--without-rrdtool \
--with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0" \
--with-librrd \
--without-libpcre \
--without-libpcap \
CONFIGURE_VARS+= \
CFLAGS="$(TARGET_CFLAGS) -DSOCKET_COMM" \
EXTRA_LDFLAGS+= -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
ifeq ($(BUILD_VARIANT),rrdtool10)
TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/lib/rrdtool-1.0/include $(TARGET_CPPFLAGS)
TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib/rrdtool-1.0/lib $(TARGET_CPPFLAGS)
endif
ifeq ($(BUILD_VARIANT),rrdtool12)
TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/lib/rrdtool-1.2/include $(TARGET_CPPFLAGS)
TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib/rrdtool-1.2/lib $(TARGET_CPPFLAGS)
endif
define Package/rrdcollect/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rrdcollect $(1)/usr/sbin/
endef
Package/rrdcollect10/install = $(Package/rrdcollect/install)
Package/rrdcollect12/install = $(Package/rrdcollect/install)
define Package/rrdcollect-example/conffiles
/etc/rrd.conf
/etc/rrdcollect.conf
endef
define Package/rrdcollect-example/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) ./files/rrd.conf $(1)/etc/
@ -92,5 +149,10 @@ define Package/rrdcollect-example/install
ln -sf /var/lib/rrdcollect/img $(1)/www/img
endef
$(eval $(call BuildPackage,rrdcollect))
$(eval $(call BuildPackage,rrdcollect-example))
Package/rrdcollect10-example/install = $(Package/rrdcollect-example/install)
Package/rrdcollect12-example/install = $(Package/rrdcollect-example/install)
$(eval $(call BuildPackage,rrdcollect10))
$(eval $(call BuildPackage,rrdcollect10-example))
$(eval $(call BuildPackage,rrdcollect12))
$(eval $(call BuildPackage,rrdcollect12-example))

View File

@ -1,11 +1,10 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2006-2011 OpenWrt.org
START=98
BIN=rrdcollect
DEFAULT=/etc/default/$BIN
RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
SERVICE_USE_PID=1
LIB_D=/var/lib/rrdcollect
CGI_S=$LIB_D/rrd.cgi
IMG_D=$LIB_D/img
@ -13,16 +12,14 @@ RRD_D=$LIB_D/rrd
start() {
RRD_F=$(find $RRD_D -name "*.rrd" 2>/dev/null)
[ -f $DEFAULT ] && . $DEFAULT
mkdir -p $RUN_D
mkdir -p $IMG_D
mkdir -p $RRD_D
mkdir -m 0755 -p $IMG_D
mkdir -m 0755 -p $RRD_D
[ -n "$RRD_F" ] || /usr/bin/rrd.sh init
[ -x $CGI_S ] || /usr/bin/rrd.sh cgi
$BIN $OPTIONS
service_start /usr/sbin/rrdcollect
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
service_stop /usr/sbin/rrdcollect
}