1
0

Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #
  2. # Copyright (C) 2010-2016 OpenWrt.org
  3. # Copyright (C) 2009-2016 Thomas Heil <heil@terminal-consulting.de>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=haproxy
  10. PKG_VERSION:=1.8.4
  11. PKG_RELEASE:=01
  12. PKG_SOURCE:=haproxy-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=https://www.haproxy.org/download/1.8/src/
  14. PKG_HASH:=e305b0a4e7dec08072841eef6ac6dcd1b5586b1eff09c2d51e152a912e8884a6
  15. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  16. PKG_LICENSE:=GPL-2.0
  17. MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
  18. include $(INCLUDE_DIR)/package.mk
  19. define Package/haproxy/Default
  20. SUBMENU:=Web Servers/Proxies
  21. SECTION:=net
  22. CATEGORY:=Network
  23. TITLE:=The Reliable, High Performance TCP/HTTP Load Balancer
  24. URL:=https://www.haproxy.org/
  25. endef
  26. define Download/lua534
  27. FILE:=lua-5.3.4.tar.gz
  28. URL:=https://www.lua.org/ftp/
  29. HASH:=f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c
  30. endef
  31. define Build/Prepare
  32. $(call Build/Prepare/Default)
  33. ifeq ($(ENABLE_LUA),y)
  34. tar -zxvf $(DL_DIR)/lua-5.3.4.tar.gz -C $(PKG_BUILD_DIR)
  35. ln -s $(PKG_BUILD_DIR)/lua-5.3.4 $(PKG_BUILD_DIR)/lua
  36. endif
  37. endef
  38. define Package/haproxy/Default/conffiles
  39. /etc/haproxy.cfg
  40. endef
  41. define Package/haproxy/Default/description
  42. Open source Reliable, High Performance TCP/HTTP Load Balancer.
  43. endef
  44. define Package/haproxy
  45. DEPENDS+= +libpcre +libltdl +zlib +libpthread +libopenssl +libncursesw +libreadline +libatomic +@OPENSSL_WITH_DEPRECATED +@OPENSSL_WITH_EC +@OPENSSL_WITH_EC2M +@OPENSSL_WITH_DTLS +@OPENSSL_WITH_COMPRESSION +@OPENSSL_WITH_NPN +@OPENSSL_WITH_PSK +@OPENSSL_WITH_SRP +@OPENSSL_ENGINE_DIGEST +@OPENSSL_ENGINE_CRYPTO
  46. TITLE+= (with SSL support)
  47. VARIANT:=ssl
  48. $(call Package/haproxy/Default)
  49. endef
  50. define Package/haproxy/conffiles
  51. $(call Package/haproxy/Default/conffiles)
  52. endef
  53. define Package/haproxy/description
  54. $(call Package/haproxy/Default/description)
  55. This package is built with SSL and LUA support.
  56. endef
  57. define Package/haproxy/config
  58. select CONFIG_OPENSSL_WITH_DEPRECATED
  59. $(call Package/haproxy/Default/config)
  60. endef
  61. define Package/haproxy-nossl
  62. TITLE+= (without SSL support)
  63. VARIANT:=nossl
  64. DEPENDS+= +libpcre +libltdl +zlib +libpthread +libatomic
  65. TITLE+= (without SSL support)
  66. $(call Package/haproxy/Default)
  67. endef
  68. define Package/haproxy-nossl/conffiles
  69. $(call Package/haproxy/Default/conffiles)
  70. endef
  71. define Package/haproxy-nossl/description
  72. $(call Package/haproxy/Default/description)
  73. This package is built without SSL support.
  74. endef
  75. ENABLE_LUA:=y
  76. ENABLE_REGPARM:=n
  77. ifeq ($(CONFIG_mips),y)
  78. ENABLE_LUA:=n
  79. endif
  80. ifeq ($(CONFIG_mipsel),y)
  81. ENABLE_LUA:=n
  82. endif
  83. ifeq ($(CONFIG_TARGET_x86),y)
  84. ENABLE_REGPARM:=y
  85. endif
  86. ifeq ($(CONFIG_avr32),y)
  87. LINUX_TARGET:=linux26
  88. else
  89. LINUX_TARGET:=linux2628
  90. endif
  91. ifeq ($(BUILD_VARIANT),ssl)
  92. ADDON+=USE_OPENSSL=1
  93. ADDON+=ADDLIB="-lcrypto -lm "
  94. endif
  95. ifeq ($(ENABLE_LUA),y)
  96. ADDON+=USE_LUA=1
  97. ADDON+=LUA_LIB_NAME="lua534"
  98. ADDON+=LUA_INC="$(STAGING_DIR)/lua-5.3.4/include"
  99. ADDON+=LUA_LIB="$(STAGING_DIR)/lua-5.3.4/lib"
  100. endif
  101. ifeq ($(ENABLE_REGPARM),y)
  102. ADDON+=USE_REGPARM=1
  103. endif
  104. ifeq ($(ENABLE_LUA),y)
  105. define Build/Compile/lua
  106. $(MAKE) TARGET=$(LINUX_TARGET) -C $(PKG_BUILD_DIR)/lua \
  107. INSTALL_TOP="$(STAGING_DIR)/lua-5.3.4/" \
  108. CC="$(TARGET_CC)" \
  109. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  110. LDFLAGS="$(TARGET_LDFLAGS) -lncurses -lreadline" \
  111. LD="$(TARGET_LD)" \
  112. linux install
  113. mv $(STAGING_DIR)/lua-5.3.4/lib/liblua.a $(STAGING_DIR)/lua-5.3.4/lib/liblua534.a
  114. endef
  115. endif
  116. define Build/Compile
  117. $(call Build/Compile/lua)
  118. $(MAKE) TARGET=$(LINUX_TARGET) -C $(PKG_BUILD_DIR) \
  119. DESTDIR="$(PKG_INSTALL_DIR)" \
  120. CC="$(TARGET_CC)" \
  121. PCREDIR="$(STAGING_DIR)/usr/" \
  122. SMALL_OPTS="-DBUFSIZE=16384 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=165530 " \
  123. USE_LINUX_TPROXY=1 USE_LINUX_SPLICE=1 USE_TFO=1 \
  124. USE_ZLIB=yes USE_PCRE=1 USE_PCRE_JIT=1 USE_GETADDRINFO=1 \
  125. VERSION="$(PKG_VERSION)-patch$(PKG_RELEASE)" \
  126. $(ADDON) \
  127. LD="$(TARGET_CC)" \
  128. LDFLAGS="$(TARGET_LDFLAGS) -latomic" \
  129. IGNOREGIT=1
  130. $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
  131. DESTDIR="$(PKG_INSTALL_DIR)" \
  132. LD="$(TARGET_CC)" \
  133. LDFLAGS="$(TARGET_LDFLAGS)" \
  134. $(MAKE_FLAGS) \
  135. install
  136. $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/contrib/halog \
  137. DESTDIR="$(PKG_INSTALL_DIR)" \
  138. $(MAKE_FLAGS) \
  139. ADDLIB="-lcrypto" \
  140. VERSION="$(PKG_VERSION)-patch$(PKG_RELEASE)" \
  141. halog
  142. endef
  143. define Package/haproxy/install
  144. $(INSTALL_DIR) $(1)/usr/sbin
  145. $(INSTALL_BIN) $(PKG_BUILD_DIR)/haproxy $(1)/usr/sbin/
  146. $(INSTALL_DIR) $(1)/etc
  147. $(INSTALL_CONF) ./files/haproxy.cfg $(1)/etc/
  148. $(INSTALL_DIR) $(1)/etc/init.d
  149. $(INSTALL_BIN) ./files/haproxy.init $(1)/etc/init.d/haproxy
  150. $(INSTALL_DIR) $(1)/etc/hotplug.d/net
  151. $(INSTALL_BIN) ./files/haproxy.hotplug $(1)/etc/hotplug.d/net/90-haproxy
  152. endef
  153. Package/haproxy-nossl/install = $(Package/haproxy/install)
  154. define Package/halog
  155. MENU:=1
  156. $(call Package/haproxy)
  157. TITLE+= halog
  158. DEPENDS:=haproxy
  159. endef
  160. define Package/halog/description
  161. HAProxy Log Analyzer
  162. endef
  163. define Package/halog/install
  164. $(INSTALL_DIR) $(1)/usr/bin
  165. $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/halog/halog $(1)/usr/bin/
  166. endef
  167. $(eval $(call Download,lua534))
  168. $(eval $(call BuildPackage,haproxy))
  169. $(eval $(call BuildPackage,halog))
  170. $(eval $(call BuildPackage,haproxy-nossl))