Hello,

On Thursday 26 April 2012 16:44:02 Abaakouk Mehdi wrote:
> RESENT: Updated patch with last remarks fixed
> 
> 
> Makefile and patch for package NUT 2.6.3
> 
> Signed-off-by: Mehdi Abaakouk <[email protected]>

I do not see any drivers in menuconfig with your Makefile. I would suggest 
doing 
the following instead:

- make the driver macro self-contained, such that it also does the call to 
BuildPackage
- rename this macro to BuildDriver for instance and get rid of the foreach 
since it can be error prone with respect to escaping make variables

> 
> 
> Index: utils/nut/patches/001-fix-missing-libmath-flags.patch
> ===================================================================
> --- utils/nut/patches/001-fix-missing-libmath-flags.patch     (revision 0)
> +++ utils/nut/patches/001-fix-missing-libmath-flags.patch     (revision 0)
> @@ -0,0 +1,11 @@
> +--- nut-2.6.3.orig/drivers/Makefile.am       2011-12-05 16:36:46.000000000 
> +0100
> ++++ nut-2.6.3/drivers/Makefile.am    2012-04-19 10:51:52.152059206 +0200
> +@@ -165,7 +165,7 @@
> + tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
> +
> + bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c usb-common.c
> +-bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
> ++bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
> +
> + blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c usb-common.c
> + blazer_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
> Index: utils/nut/Makefile
> ===================================================================
> --- utils/nut/Makefile        (revision 0)
> +++ utils/nut/Makefile        (revision 0)
> @@ -0,0 +1,215 @@
> +#
> +# Copyright (C) 2006-2012 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License 
> v2.
> +# See /LICENSE for more information.
> +#
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=nut
> +PKG_VERSION:=2.6.3
> +PKG_RELEASE:=1
> +
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> +PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.6/
> +PKG_MD5SUM:=8db00c21f8bc03add6e14d15f634ec6a
> +
> +PKG_BUILD_DEPENDS:=libusb libnetsnmp
> +PKG_FIXUP:=autoreconf
> +PKG_INSTALL:=1
> +
> +PKG_BUILD_PARALLEL:=1
> +
> +define Package/nut/Default
> +  URL:=http://www.networkupstools.org/
> +  TITLE:= Network UPS Tools
> +  DEPENDS:=@USB_SUPPORT +libnetsnmp
> +  SECTION:=utils
> +  CATEGORY:=Utilities
> +endef
> +
> +define Package/nut/description
> +  Network UPS Tools (NUT) is a client/server monitoring system that
> +  allows computers to share uninterruptible power supply (UPS) and
> +  power distribution unit (PDU) hardware. Clients access the hardware
> +  through the server, and are notified whenever the power status
> +  changes.
> +endef
> +
> +define Package/nut
> +$(call Package/nut/Default)
> +  MENU:=1
> +#  TITLE+= (common)
> +endef
> +
> +define Package/nut-server
> +$(call Package/nut/Default)
> +  TITLE+= (server)
> +  DEPENDS+= nut
> +endef
> +
> +define Package/nut-client
> +$(call Package/nut/Default)
> +  TITLE+= (client)
> +  DEPENDS+= nut
> +endef
> +
> +define Package/nut-logger
> +$(call Package/nut/Default)
> +  TITLE+= (logger)
> +  DEPENDS+= nut
> +endef
> +
> +define Package/nut-monitor
> +$(call Package/nut/Default)
> +  TITLE+= (monitor)
> +  DEPENDS+= nut
> +endef
> +
> +define Package/nut/install
> +     $(INSTALL_DIR) $(1)/usr/lib
> +     $(INSTALL_DIR) $(1)/etc/nut
> +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libupsclient.so* $(1)/usr/lib/
> +     $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample 
> $(1)/etc/nut/nut.conf
> +     $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/ups.conf.sample 
> $(1)/etc/nut/ups.conf
> +endef
> +
> +define Package/nut/conffiles
> +/etc/nut/nut.conf
> +/etc/nut/ups.conf
> +endef
> +
> +define Package/nut-client/install
> +     $(INSTALL_DIR) $(1)/usr/bin
> +     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin
> +     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin
> +     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin
> +endef
> +
> +define Package/nut-server/install
> +     $(INSTALL_DIR) $(1)/etc/nut
> +     $(INSTALL_DIR) $(1)/usr/sbin
> +     $(INSTALL_DIR) $(1)/lib/nut
> +     $(INSTALL_DIR) $(1)/usr/share/nut
> +
> +     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsd $(1)/usr/sbin
> +     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/nut/upsdrvctl $(1)/lib/nut
> +     $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.conf.sample 
> $(1)/etc/nut/upsd.conf
> +     $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.users.sample 
> $(1)/etc/nut/upsd.users
> +     $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/nut/cmdvartab 
> $(1)/usr/share/nut/cmdvartab
> +     $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/nut/driver.list 
> $(1)/usr/share/nut/driver.list
> +endef
> +
> +define Package/nut-server/conffiles
> +/etc/nut/upsd.users
> +/etc/nut/upsd.conf
> +endef
> +
> +define Package/nut-logger/install
> +     $(INSTALL_DIR) $(1)/usr/bin
> +     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin
> +endef
> +
> +define Package/nut-monitor/install
> +     $(INSTALL_DIR) $(1)/usr/sbin
> +     $(INSTALL_DIR) $(1)/etc/nut
> +     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin
> +     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upssched $(1)/usr/sbin
> +     $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsmon.conf.sample 
> $(1)/etc/nut/upsmon.conf
> +     $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample 
> $(1)/etc/nut/upssched.conf
> +endef
> +
> +define Package/nut-monitor/conffiles
> +/etc/nut/upsmon.conf
> +/etc/nut/upssched.conf
> +endef
> +
> +NUT_DRIVERS :=
> +
> +define driver
> +  define Package/nut-driver-$(strip $(1))
> +    $(call Package/nut/Default)
> +    TITLE+= ($(strip $(1)) driver)
> +    DEPENDS+=libusb nut-server
> +  endef
> +
> +  define Package/nut-driver-$(strip $(1))/description
> +    $(strip $(2))
> +  endef
> +
> +  define Package/nut-driver-$(strip $(1))/install
> +     $(INSTALL_DIR) $$(1)/lib/nut/
> +     $(INSTALL_BIN) $$(PKG_INSTALL_DIR)/lib/nut/$(strip $(1)) 
> $$(1)/lib/nut/
> +  endef
> +
> +  NUT_DRIVERS += nut-driver-$(strip $(1))
> +endef
> +
> +
> +$(eval $(call driver,tripplite_usb,Driver for older Tripp Lite USB 
> UPSes (not PDC HID)))
> +$(eval $(call driver,powercom,UPS driver for Powercom/Trust/Advice UPS 
> equipment))
> +$(eval $(call driver,rhino,Driver for Brazilian Microsol RHINO UPS 
> equipment))
> +$(eval $(call driver,apcsmart-old,Driver for American Power Conversion 
> Smart Protocol UPS equipment))
> +$(eval $(call driver,usbhid-ups,Driver for USB/HID UPS equipment))
> +$(eval $(call driver,masterguard,Driver for Masterguard UPS 
> equipment))
> +$(eval $(call driver,bestuferrups,Driver for Best Power 
> Micro-Ferrups))
> +$(eval $(call driver,tripplitesu,Driver for Tripp-Lite SmartOnline 
> (SU) UPS equipment))
> +$(eval $(call driver,apcsmart,Driver for American Power Conversion 
> Smart Protocol UPS equipment))
> +$(eval $(call driver,genericups,Driver for contact-closure UPS 
> equipment))
> +$(eval $(call driver,dummy-ups,Driver for multi-purpose UPS 
> emulation))
> +$(eval $(call driver,clone,UPS driver clone))
> +$(eval $(call driver,blazer_ser,Driver for Megatec/Q1 protocol 
> serial))
> +$(eval $(call driver,everups,Driver for Ever UPS models))
> +$(eval $(call driver,upscode2,Driver for UPScode II compatible UPS 
> equipment))
> +$(eval $(call driver,newmge-shut,Driver for SHUT Protocol UPS 
> equipment))
> +$(eval $(call driver,bcmxcp,Driver for UPSes supporting the serial 
> BCM/XCP protocol))
> +$(eval $(call driver,richcomm_usb,Driver UPS equipment using Richcomm 
> dry-contact to USB solution))
> +$(eval $(call driver,metasys,Driver for Meta System UPS equipment))
> +$(eval $(call driver,mge-utalk,Driver for MGE UPS SYSTEMS UTalk 
> protocol equipment))
> +$(eval $(call driver,powerpanel,Driver for PowerPanel Plus compatible 
> UPS equipment))
> +$(eval $(call driver,mge-shut,Driver for SHUT Protocol UPS equipment))
> +$(eval $(call driver,liebert,Driver for Liebert contact-closure UPS 
> equipment))
> +$(eval $(call driver,bcmxcp_usb,Experimental driver for UPSes 
> supporting the BCM/XCP protocol over USB))
> +$(eval $(call driver,bestfortress,Driver for old Best Fortress UPS 
> equipment))
> +$(eval $(call driver,belkin,Driver for Belkin serial UPS equipment))
> +$(eval $(call driver,optiups,Driver for Opti-UPS (Viewsonic) UPS and 
> Zinto D (ONLINE-USV) equipment))
> +$(eval $(call driver,isbmex,Driver for ISBMEX UPS equipment))
> +$(eval $(call driver,victronups,Driver for IMV/Victron UPS unit Match, 
> Match Lite, NetUps))
> +$(eval $(call driver,bestfcom,Driver for Best Power Fortress/Ferrups))
> +$(eval $(call driver,belkinunv,Driver for Belkin "Universal UPS" and 
> compatible))
> +$(eval $(call driver,solis,Driver for Brazilian Microsol SOLIS UPS 
> equipment))
> +$(eval $(call driver,etapro,Driver for ETA UPS equipment))
> +$(eval $(call driver,blazer_usb,grep: Driver for Megatec/Q1 protocol 
> USB))
> +$(eval $(call driver,ivtscd,driver for the IVT Solar Controller 
> Device))
> +$(eval $(call driver,gamatronic,Driver for Gamatronic UPS equipment))
> +$(eval $(call driver,tripplite,Driver for Tripp-Lite SmartPro UPS 
> equipment))
> +$(eval $(call driver,bestups,Driver for Best Power / SOLA (Phoenixtec 
> protocol) UPS equipment))
> +$(eval $(call driver,oneac,Driver for Oneac UPS equipment))
> +$(eval $(call driver,safenet,Driver for SafeNet compatible UPS 
> equipment))
> +
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +CONFIGURE_ARGS += \
> +  --without-ssl \
> +  --with-pidpath=/var/run \
> +  --with-statepath=/var/run \
> +  --with-altpidpath=/var/run \
> +  --sysconfdir=/etc/nut \
> +  --with-drvpath=/lib/nut \
> +  --datadir=/usr/share/nut \
> +  --with-user=root \
> +  --with-group=root \
> +  --with-usb \
> +  --with-snmp \
> +  --without-libltdl
> +
> +
> +$(eval $(call BuildPackage,nut))
> +$(eval $(call BuildPackage,nut-client))
> +$(eval $(call BuildPackage,nut-server))
> +$(eval $(call BuildPackage,nut-monitor))
> +$(eval $(call BuildPackage,nut-logger))
> +$(foreach m,$(NUT_DRIVERS),$(eval $(call BuildPackage,$(m))))
> +
> 
> _______________________________________________
> openwrt-devel mailing list
> [email protected]
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to