Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #
  2. # Copyright 2013 Luke Dashjr
  3. #
  4. # This program is free software; you can redistribute it and/or modify it
  5. # under the terms of the GNU General Public License as published by the Free
  6. # Software Foundation; either version 3 of the License, or (at your option)
  7. # any later version. See COPYING for more details.
  8. #
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=bfgminer
  11. PKG_TITLE:=BFGMiner
  12. PKG_VERSION:=3.1.0
  13. PKG_RELEASE:=1
  14. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tbz2
  15. PKG_SOURCE_URL:=http://luke.dashjr.org/programs/bitcoin/files/$(PKG_NAME)/$(PKG_VERSION)/
  16. PKG_INSTALL:=1
  17. include $(INCLUDE_DIR)/package.mk
  18. define Download/uthash
  19. FILE:=v1.9.8
  20. URL:=https://codeload.github.com/troydhanson/uthash/tar.gz/
  21. endef
  22. $(eval $(call Download,uthash))
  23. define Package/$(PKG_NAME)/Default
  24. MAINTAINER:="Luke Dashjr" <luke_openwrt@dashjr.org>
  25. SECTION:=utils
  26. CATEGORY:=Utilities
  27. URL:=http://luke.dashjr.org/programs/$(PKG_NAME)
  28. DEPENDS:=+$(PKG_NAME)
  29. endef
  30. define Package/$(PKG_NAME)
  31. $(call Package/$(PKG_NAME)/Default)
  32. TITLE:=$(PKG_TITLE) (Bitcoin miner)
  33. DEPENDS:=+libc +libcurl +libpthread +jansson +PACKAGE_$(PKG_NAME)_curses:libncurses +PACKAGE_$(PKG_NAME)_libusb:libusb-1.0
  34. endef
  35. define Package/$(PKG_NAME)/description
  36. Modular Bitcoin CPU/GPU/FPGA miner in C
  37. endef
  38. define Package/$(PKG_NAME)/config
  39. config PACKAGE_$(PKG_NAME)_curses
  40. bool "Build with curses TUI support"
  41. depends on PACKAGE_$(PKG_NAME)
  42. default y
  43. config PACKAGE_$(PKG_NAME)_libusb
  44. bool "Build with libusb support (X6500 & ZTEX)"
  45. depends on PACKAGE_$(PKG_NAME)
  46. default y
  47. endef
  48. ifndef CONFIG_PACKAGE_$(PKG_NAME)_curses
  49. CONFIGURE_ARGS += --without-curses
  50. else
  51. CONFIGURE_ARGS += --with-curses=ncurses
  52. endif
  53. ifndef CONFIG_PACKAGE_$(PKG_NAME)_libusb
  54. CONFIGURE_ARGS += --disable-x6500 --disable-ztex
  55. endif
  56. TARGET_CFLAGS += -std=gnu99
  57. TARGET_CFLAGS += -Iuthash-1.9.8/src
  58. CONFIGURE_ARGS += --without-libudev
  59. CONFIGURE_ARGS += --without-sensors
  60. define Build/Prepare
  61. $(call Build/Prepare/Default)
  62. gzip -dc $(DL_DIR)/v1.9.8 | $(HOST_TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
  63. endef
  64. define Build/Configure
  65. # Need to remake configure etc to pick up on cross-compiler libtool
  66. ( cd $(PKG_BUILD_DIR); NOSUBMODULES=1 ./autogen.sh; )
  67. $(call Build/Configure/Default)
  68. endef
  69. define Package/$(PKG_NAME)/install
  70. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
  71. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin
  72. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME)-rpc $(1)/usr/bin
  73. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libblkmaker*.so* $(1)/usr/lib
  74. endef
  75. ALL_$(PKG_NAME)_PACKAGES += $(PKG_NAME)
  76. #### BitForce firmware flash ####
  77. define Package/bitforce-firmware-flash
  78. $(call Package/$(PKG_NAME)/Default)
  79. TITLE:=BitForce firmware flash tool
  80. endef
  81. define Package/bitforce-firmware-flash/description
  82. BitForce firmware flash tool
  83. endef
  84. define Package/bitforce-firmware-flash/install
  85. $(INSTALL_DIR) $(1)/usr/bin
  86. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/bitforce-firmware-flash $(1)/usr/bin
  87. endef
  88. ALL_$(PKG_NAME)_PACKAGES += bitforce-firmware-flash
  89. #### Bitstreams ####
  90. define Package/$(PKG_NAME)/BitstreamTemplate
  91. define Package/$(PKG_NAME)-bitstream-$(1)
  92. $(call Package/$(PKG_NAME)/Default)
  93. TITLE:=$(2)
  94. PKGARCH:=all
  95. endef
  96. define Package/$(PKG_NAME)-bitstream-$(1)/description
  97. $(2)
  98. endef
  99. define Package/$(PKG_NAME)-bitstream-$(1)/install
  100. $(INSTALL_DIR) $$(1)/usr/share/$(PKG_NAME)/bitstreams
  101. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/bitstreams/$(subst -,_,$(1))* $$(1)/usr/share/$(PKG_NAME)/bitstreams
  102. endef
  103. ALL_$(PKG_NAME)_PACKAGES += $(PKG_NAME)-bitstream-$(1)
  104. endef
  105. define Package/$(PKG_NAME)/ZtexBitstreamTemplate
  106. $(call Package/$(PKG_NAME)/BitstreamTemplate,ztex-$(1),Ztex $(2) FPGA bitstream (for $(PKG_TITLE) w/ libusb support))
  107. endef
  108. $(eval $(call Package/$(PKG_NAME)/BitstreamTemplate,fpgaminer,ModMiner/X6500 FPGA bitstream (for $(PKG_TITLE))))
  109. $(eval $(call Package/$(PKG_NAME)/ZtexBitstreamTemplate,ufm1_15b1,1.15b))
  110. $(eval $(call Package/$(PKG_NAME)/ZtexBitstreamTemplate,ufm1_15d1,1.15d))
  111. $(eval $(call Package/$(PKG_NAME)/ZtexBitstreamTemplate,ufm1_15d3,1.15d))
  112. $(eval $(call Package/$(PKG_NAME)/ZtexBitstreamTemplate,ufm1_15d4,1.15d & 1.15x))
  113. $(eval $(call Package/$(PKG_NAME)/ZtexBitstreamTemplate,ufm1_15y1,1.15y))
  114. $(foreach bitstream,$(ALL_$(PKG_NAME)_PACKAGES),$(eval $(call BuildPackage,$(bitstream))))