1
0

Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include ${TOPDIR}/rules.mk
  4. PKG_NAME:= nut
  5. PKG_VERSION:= 2.4.1
  6. PKG_RELEASE:= 1
  7. ifneq (${ADK_PACKAGE_NUT_SSL},)
  8. PKG_BUILDDEP+= openssl
  9. endif
  10. ifneq (${ADK_PACKAGE_NUT_USB},)
  11. PKG_BUILDDEP+= libusb
  12. endif
  13. ifneq (${ADK_PACKAGE_NUT_SNMP},)
  14. PKG_BUILDDEP+= net-snmp
  15. endif
  16. PKG_MD5SUM:= 609ebaf2123fc7171d25a6c742dd7d66
  17. PKG_DESCR:= Network UPS Tools
  18. PKG_SECTION:= sys
  19. PKG_URL:= http://www.networkupstools.org
  20. PKG_SITES:= http://www.networkupstools.org/source/2.4/
  21. include ${TOPDIR}/mk/package.mk
  22. ifneq (${ADK_PACKAGE_NUT_SNMP},)
  23. PKG_DEPENDS+= libnetsnmp
  24. endif
  25. ifneq (${ADK_PACKAGE_NUT_USB},)
  26. PKG_DEPENDS+= libusb
  27. endif
  28. ifneq (${ADK_PACKAGE_NUT_SSL},)
  29. PKG_DEPENDS+= libopenssl
  30. endif
  31. $(eval $(call PKG_template,NUT,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
  32. define DRIVER_template
  33. DRIVERS_$${ADK_PACKAGE_NUT_DRIVER_${1}}+=${2}
  34. endef
  35. DRIVERS_y:=
  36. $(eval $(call DRIVER_template,BESTUPS,bestups))
  37. $(eval $(call DRIVER_template,APCSMART,apcsmart))
  38. $(eval $(call DRIVER_template,EVERUPS,everups))
  39. $(eval $(call DRIVER_template,BELKIN,belkin))
  40. $(eval $(call DRIVER_template,MASTERGUARD,masterguard))
  41. $(eval $(call DRIVER_template,POWERCOM,powercom))
  42. $(eval $(call DRIVER_template,POWERPANEL,powerpanel))
  43. $(eval $(call DRIVER_template,CYBERPOWER,cyberpower))
  44. $(eval $(call DRIVER_template,TRIPPLITE,tripplite))
  45. $(eval $(call DRIVER_template,VICTRONUPS,victronups))
  46. $(eval $(call DRIVER_template,GENERICUPS,genericups))
  47. $(eval $(call DRIVER_template,MGE_UTALK,mge-utalk))
  48. $(eval $(call DRIVER_template,BESTUFERRUPS,bestuferrups))
  49. $(eval $(call DRIVER_template,ISBMEX,isbmex))
  50. $(eval $(call DRIVER_template,ETAPRO,etapro))
  51. $(eval $(call DRIVER_template,LIEBERT,liebert))
  52. $(eval $(call DRIVER_template,TRIPPLITESU,tripplitesu))
  53. $(eval $(call DRIVER_template,SAFENET,safenet))
  54. $(eval $(call DRIVER_template,BELKINUNV,belkinunv))
  55. $(eval $(call DRIVER_template,ONEAC,oneac))
  56. $(eval $(call DRIVER_template,METASYS,metasys))
  57. $(eval $(call DRIVER_template,BESTFCOM,bestfcom))
  58. $(eval $(call DRIVER_template,UPSCODE2,upscode2))
  59. $(eval $(call DRIVER_template,SOLIS,solis))
  60. $(eval $(call DRIVER_template,GAMATRONIC,gamatronic))
  61. $(eval $(call DRIVER_template,MEGATEC,megatec))
  62. $(eval $(call DRIVER_template,RHINO,rhino))
  63. CONFIG_DRIVERS=$(shell echo ${DRIVERS_y} | tr ' ' ',')
  64. INSTALL_DRIVERS_tmp=${DRIVERS_y}
  65. ifneq (${ADK_PACKAGE_NUT_USB},)
  66. INSTALL_DRIVERS_tmp+= usbhid-ups tripplite_usb
  67. endif
  68. ifneq (${ADK_PACKAGE_NUT_SNMP},)
  69. INSTALL_DRIVERS_tmp+= snmp-ups
  70. endif
  71. INSTALL_DRIVERS=$(shell echo ${INSTALL_DRIVERS_tmp} | tr ' ' ',')
  72. CONFIGURE_STYLE:= gnu
  73. CONFIGURE_ARGS+= --with-linux-hiddev=${LINUX_DIR}/include/linux/hiddev.h \
  74. --without-cgi \
  75. --with-drivers=${INSTALL_DRIVERS} \
  76. --with-group=0 \
  77. --with-user=0
  78. ifneq (${ADK_PACKAGE_NUT_SSL},)
  79. CONFIGURE_ARGS+= --with-ssl
  80. CONFIGURE_ENV+= CPPFLAGS="${TCPPFLAGS} ${TLDFLAGS}"
  81. MAKE_FLAGS+= SSL_CFLAGS="${TCPPFLAGS}" SSL_LDFLAGS="${TLDFLAGS} -lssl -lcrypto"
  82. endif
  83. BUILD_STYLE:= auto
  84. ALL_TARGET:= all
  85. INSTALL_STYLE:= auto
  86. INSTALL_TARGET:= install
  87. ifneq (${ADK_PACKAGE_NUT_USB},)
  88. ALL_TARGET+= usb
  89. INSTALL_TARGET+= install-usb
  90. endif
  91. ifneq (${ADK_PACKAGE_NUT_SNMP},)
  92. ALL_TARGET+= snmp
  93. INSTALL_TARGET+= install-snmp
  94. endif
  95. post-install:
  96. ${INSTALL_DIR} ${IDIR_NUT}/usr/{s,}bin ${IDIR_NUT}/etc
  97. ${INSTALL_DIR} ${IDIR_NUT}/usr/lib
  98. ${INSTALL_BIN} ${WRKINST}/usr/sbin/ups{d,mon,sched} \
  99. ${IDIR_NUT}/usr/sbin/
  100. ${CP} ${WRKINST}/usr/lib/lib*.so* ${IDIR_NUT}/usr/lib
  101. ${INSTALL_BIN} ${WRKINST}/usr/bin/{${INSTALL_DRIVERS}} \
  102. ${IDIR_NUT}/usr/bin/
  103. ${INSTALL_BIN} ${WRKINST}/usr/bin/ups{c,cmd,drvctl,log,rw} \
  104. ${IDIR_NUT}/usr/bin/
  105. ${INSTALL_DATA} ./files/ups{d,}.conf ${IDIR_NUT}/etc/
  106. ifneq (${ADK_PACKAGE_NUT_VARDESC},)
  107. ${INSTALL_DIR} ${IDIR_NUT}/usr/share
  108. ${INSTALL_DATA} ${WRKINST}/usr/share/cmdvartab \
  109. ${IDIR_NUT}/usr/share/
  110. endif
  111. include ${TOPDIR}/mk/pkg-bottom.mk