You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
4.9 KiB

  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.7.1
  11. PKG_RELEASE:=19
  12. PKG_SOURCE:=haproxy-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=http://haproxy.1wt.eu/download/1.7/src/
  14. PKG_MD5SUM:=d0acaae02e444039e11892ea31dde478
  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:=http://haproxy.1wt.eu/
  25. endef
  26. define Download/lua533
  27. FILE:=lua-5.3.3.tar.gz
  28. URL:=http://www.lua.org/ftp/
  29. MD5SUM:=703f75caa4fdf4a911c1a72e67a27498
  30. endef
  31. define Build/Prepare
  32. $(call Build/Prepare/Default)
  33. tar -zxvf $(DL_DIR)/lua-5.3.3.tar.gz -C $(PKG_BUILD_DIR)
  34. ln -s $(PKG_BUILD_DIR)/lua-5.3.3 $(PKG_BUILD_DIR)/lua
  35. endef
  36. define Package/haproxy/Default/conffiles
  37. /etc/haproxy.cfg
  38. endef
  39. define Package/haproxy/Default/description
  40. Open source Reliable, High Performance TCP/HTTP Load Balancer.
  41. endef
  42. define Package/haproxy
  43. DEPENDS+= +libpcre +libltdl +zlib +libpthread +libopenssl +libncursesw +libreadline +@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
  44. TITLE+= (with SSL support)
  45. VARIANT:=ssl
  46. $(call Package/haproxy/Default)
  47. endef
  48. define Package/haproxy/conffiles
  49. $(call Package/haproxy/Default/conffiles)
  50. endef
  51. define Package/haproxy/description
  52. $(call Package/haproxy/Default/description)
  53. This package is built with SSL and LUA support.
  54. endef
  55. define Package/haproxy/config
  56. select CONFIG_OPENSSL_WITH_DEPRECATED
  57. $(call Package/haproxy/Default/config)
  58. endef
  59. define Package/haproxy-nossl
  60. TITLE+= (without SSL support)
  61. VARIANT:=nossl
  62. DEPENDS+= +libpcre +libltdl +zlib +libpthread
  63. TITLE+= (without SSL support)
  64. $(call Package/haproxy/Default)
  65. endef
  66. define Package/haproxy-nossl/conffiles
  67. $(call Package/haproxy/Default/conffiles)
  68. endef
  69. define Package/haproxy-nossl/description
  70. $(call Package/haproxy/Default/description)
  71. This package is built without SSL support.
  72. endef
  73. ifeq ($(CONFIG_avr32),y)
  74. LINUX_TARGET:=linux26
  75. else
  76. LINUX_TARGET:=linux2628
  77. endif
  78. ifeq ($(BUILD_VARIANT),ssl)
  79. ADDON+=USE_OPENSSL=1
  80. ADDON+=USE_LUA=1
  81. ADDON+=LUA_LIB_NAME="lua533"
  82. ADDON+=LUA_INC="$(STAGING_DIR)/lua-5.3.3/include"
  83. ADDON+=LUA_LIB="$(STAGING_DIR)/lua-5.3.3/lib"
  84. ADDON+=ADDLIB="-lcrypto -lm "
  85. else
  86. ADDON+=ADDLIB="-lm"
  87. endif
  88. define Build/Compile
  89. $(MAKE) TARGET=$(LINUX_TARGET) -C $(PKG_BUILD_DIR)/lua \
  90. INSTALL_TOP="$(STAGING_DIR)/lua-5.3.3/" \
  91. CC="$(TARGET_CC)" \
  92. LDFLAGS="$(TARGET_LDFLAGS) -lncurses -lreadline" \
  93. LD="$(TARGET_LD)" \
  94. linux install
  95. mv $(STAGING_DIR)/lua-5.3.3/lib/liblua.a $(STAGING_DIR)/lua-5.3.3/lib/liblua533.a
  96. $(MAKE) TARGET=$(LINUX_TARGET) -C $(PKG_BUILD_DIR) \
  97. DESTDIR="$(PKG_INSTALL_DIR)" \
  98. CC="$(TARGET_CC)" \
  99. $(ADDON)
  100. CFLAGS="$(TARGET_CFLAGS) -fno-align-jumps -fno-align-functions -fno-align-labels -fno-align-loops -pipe -fomit-frame-pointer -fhonour-copts" \
  101. LD="$(TARGET_LD)" \
  102. LDFLAGS="$(TARGET_LDFLAGS) -lcurses -lreadline" \
  103. PCREDIR="$(STAGING_DIR)/usr/include" \
  104. SMALL_OPTS="-DBUFSIZE=16384 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=165530 " \
  105. USE_LINUX_TPROXY=1 USE_LINUX_SPLICE=1 USE_REGPARM=1 \
  106. USE_ZLIB=yes USE_PCRE=1 \
  107. VERSION="$(PKG_VERSION)-patch$(PKG_RELEASE)" \
  108. IGNOREGIT=1
  109. $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
  110. DESTDIR="$(PKG_INSTALL_DIR)" \
  111. LD="$(TARGET_CC)" \
  112. LDFLAGS="$(TARGET_LDFLAGS)" \
  113. $(MAKE_FLAGS) \
  114. install
  115. $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/contrib/halog \
  116. DESTDIR="$(PKG_INSTALL_DIR)" \
  117. $(MAKE_FLAGS) \
  118. ADDLIB="-lcrypto" \
  119. VERSION="$(PKG_VERSION)-patch$(PKG_RELEASE)" \
  120. halog
  121. endef
  122. define Package/haproxy/install
  123. $(INSTALL_DIR) $(1)/usr/sbin
  124. $(INSTALL_BIN) $(PKG_BUILD_DIR)/haproxy $(1)/usr/sbin/
  125. $(INSTALL_DIR) $(1)/etc
  126. $(INSTALL_CONF) ./files/haproxy.cfg $(1)/etc/
  127. $(INSTALL_DIR) $(1)/etc/init.d
  128. $(INSTALL_BIN) ./files/haproxy.init $(1)/etc/init.d/haproxy
  129. $(INSTALL_DIR) $(1)/etc/hotplug.d/net
  130. $(INSTALL_BIN) ./files/haproxy.hotplug $(1)/etc/hotplug.d/net/90-haproxy
  131. endef
  132. Package/haproxy-nossl/install = $(Package/haproxy/install)
  133. define Package/halog
  134. MENU:=1
  135. $(call Package/haproxy)
  136. TITLE+= halog
  137. DEPENDS:=haproxy
  138. endef
  139. define Package/halog/description
  140. HAProxy Log Analyzer
  141. endef
  142. define Package/halog/install
  143. $(INSTALL_DIR) $(1)/usr/bin
  144. $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/halog/halog $(1)/usr/bin/
  145. endef
  146. $(eval $(call Download,lua533))
  147. $(eval $(call BuildPackage,haproxy))
  148. $(eval $(call BuildPackage,halog))
  149. $(eval $(call BuildPackage,haproxy-nossl))