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.

200 lines
5.6 KiB

haproxy: Fix PCRE_DIR include path haproxy's Makefile already happens include/ after specifying PCRE_DIR which would result in the following build errors on an external toolchain that does not automatically search for headers in $(STAGING_DIR): mipsel-linux-gnu-gcc -Iinclude -Iebtree -Wall -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement -DBUFSIZE=16384 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=165530 -DCONFIG_HAP_LINUX_SPLICE -DTPROXY -DCONFIG_HAP_LINUX_TPROXY -DCONFIG_HAP_CRYPT -DUSE_ZLIB -DENABLE_POLL -DENABLE_EPOLL -DUSE_CPU_AFFINITY -DASSUME_SPLICE_WORKS -DUSE_ACCEPT4 -DNETFILTER -DUSE_GETSOCKNAME -DCONFIG_REGPARM=3 -DUSE_OPENSSL -DUSE_SYSCALL_FUTEX -DUSE_LUA -I/home/florian/dev/openwrt/trunk/staging_dir/target-mipsel-unknown-linux-gnu_glibc/lua-5.3.3/include -DUSE_PCRE -I/home/florian/dev/openwrt/trunk/staging_dir/target-mipsel-unknown-linux-gnu_glibc/usr/include/include -DUSE_PCRE_JIT -DCONFIG_HAPROXY_VERSION=\"1.7.4-patch02\" -DCONFIG_HAPROXY_DATE=\"2017/04/01\" \ -DBUILD_TARGET='"linux2628"' \ -DBUILD_ARCH='""' \ -DBUILD_CPU='"generic"' \ -DBUILD_CC='"mipsel-linux-gnu-gcc"' \ -DBUILD_CFLAGS='"-O2 -g -fno-strict-aliasing -Wdeclaration-after-statement -DBUFSIZE=16384 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=165530"' \ -DBUILD_OPTIONS='"USE_LINUX_SPLICE=1 USE_LINUX_TPROXY=1 USE_ZLIB=yes USE_REGPARM=1 USE_OPENSSL=1 USE_LUA=1 USE_PCRE=1 USE_PCRE_JIT=1"' \ -c -o src/haproxy.o src/haproxy.c In file included from include/types/proxy.h:33:0, from include/proto/log.h:32, from include/common/cfgparse.h:29, from src/haproxy.c:65: include/common/regex.h:31:18: fatal error: pcre.h: No such file or directory #include <pcre.h> Fix this by stripping the additional include/ being added. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
8 years ago
  1. #
  2. # Copyright (C) 2010-2016 OpenWrt.org
  3. # Copyright (C) 2009-2016 Thomas Heil <heil@terminal-consulting.de>
  4. # Copyright (C) 2018 Christian Lachner <gladiac@gmail.com>
  5. #
  6. # This is free software, licensed under the GNU General Public License v2.
  7. # See /LICENSE for more information.
  8. #
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=haproxy
  11. PKG_VERSION:=2.0.6
  12. PKG_RELEASE:=1
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  14. PKG_SOURCE_URL:=https://www.haproxy.org/download/2.0/src
  15. PKG_HASH:=01e1da09452010111107ca1b3a8b7f1927731ba0fe4380bacae1c626fdc521e4
  16. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  17. PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>, \
  18. Christian Lachner <gladiac@gmail.com>
  19. PKG_LICENSE:=GPL-2.0-only
  20. PKG_LICENSE_FILES:=LICENSE
  21. PKG_CPE_ID:=cpe:/a:haproxy:haproxy
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/haproxy/Default
  24. SUBMENU:=Web Servers/Proxies
  25. SECTION:=net
  26. CATEGORY:=Network
  27. TITLE:=The Reliable, High Performance TCP/HTTP Load Balancer
  28. URL:=https://www.haproxy.org/
  29. endef
  30. define Download/lua535
  31. FILE:=lua-5.3.5.tar.gz
  32. URL:=https://www.lua.org/ftp/
  33. HASH:=0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac
  34. endef
  35. define Build/Prepare
  36. $(call Build/Prepare/Default)
  37. ifeq ($(ENABLE_LUA),y)
  38. tar -zxvf $(DL_DIR)/lua-5.3.5.tar.gz -C $(PKG_BUILD_DIR)
  39. ln -s $(PKG_BUILD_DIR)/lua-5.3.5 $(PKG_BUILD_DIR)/lua
  40. endif
  41. endef
  42. define Package/haproxy/Default/conffiles
  43. /etc/haproxy.cfg
  44. endef
  45. define Package/haproxy/Default/description
  46. Open source Reliable, High Performance TCP/HTTP Load Balancer.
  47. endef
  48. define Package/haproxy
  49. DEPENDS+= +libpcre +libltdl +zlib +libpthread +libopenssl +libncurses +libreadline +libatomic
  50. TITLE+= (with SSL support)
  51. VARIANT:=ssl
  52. $(call Package/haproxy/Default)
  53. endef
  54. define Package/haproxy/conffiles
  55. $(call Package/haproxy/Default/conffiles)
  56. endef
  57. define Package/haproxy/description
  58. $(call Package/haproxy/Default/description)
  59. This package is built with SSL and LUA support.
  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_TARGET_x86),y)
  78. ENABLE_REGPARM:=y
  79. endif
  80. ifeq ($(CONFIG_USE_UCLIBC),y)
  81. LINUX_TARGET:=linux-uclibc
  82. else
  83. LINUX_TARGET:=linux-glibc
  84. endif
  85. ifeq ($(BUILD_VARIANT),ssl)
  86. ADDON+=USE_OPENSSL=1
  87. ADDON+=ADDLIB="-lcrypto -lm "
  88. endif
  89. ifeq ($(ENABLE_LUA),y)
  90. ADDON+=USE_LUA=1
  91. ADDON+=LUA_LIB_NAME="lua535"
  92. ADDON+=LUA_INC="$(STAGING_DIR)/lua-5.3.5/include"
  93. ADDON+=LUA_LIB="$(STAGING_DIR)/lua-5.3.5/lib"
  94. endif
  95. ifeq ($(ENABLE_REGPARM),y)
  96. ADDON+=USE_REGPARM=1
  97. endif
  98. ifeq ($(ENABLE_LUA),y)
  99. define Build/Compile/lua
  100. $(MAKE) TARGET=$(LINUX_TARGET) -C $(PKG_BUILD_DIR)/lua \
  101. INSTALL_TOP="$(STAGING_DIR)/lua-5.3.5/" \
  102. CC="$(TARGET_CC)" \
  103. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  104. LDFLAGS="$(TARGET_LDFLAGS) -lncurses -lreadline" \
  105. LD="$(TARGET_LD)" \
  106. linux install
  107. mv $(STAGING_DIR)/lua-5.3.5/lib/liblua.a $(STAGING_DIR)/lua-5.3.5/lib/liblua535.a
  108. endef
  109. endif
  110. define Build/Compile
  111. $(call Build/Compile/lua)
  112. $(MAKE) TARGET=$(LINUX_TARGET) -C $(PKG_BUILD_DIR) \
  113. DESTDIR="$(PKG_INSTALL_DIR)" \
  114. CC="$(TARGET_CC)" \
  115. PCREDIR="$(STAGING_DIR)/usr/" \
  116. SMALL_OPTS="-DBUFSIZE=16384 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=165530" \
  117. USE_LINUX_TPROXY=1 USE_LINUX_SPLICE=1 USE_TFO=1 USE_NS=1 \
  118. USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_GETADDRINFO=1 \
  119. USE_THREAD=1 USE_PTHREAD_PSHARED=1 \
  120. VERSION="$(PKG_VERSION)" SUBVERS="-$(PKG_RELEASE)" \
  121. VERDATE="$(shell date -d @$(SOURCE_DATE_EPOCH) '+%Y/%m/%d')" IGNOREGIT=1 \
  122. $(ADDON) \
  123. CFLAGS="$(TARGET_CFLAGS) -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv -Wno-format-truncation -Wno-unused-label -Wno-sign-compare -Wno-unused-parameter -Wno-old-style-declaration -Wno-ignored-qualifiers -Wno-clobbered -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-stringop-overflow -Wno-cast-function-type -Wtype-limits -Wshift-negative-value -Wshift-overflow=2 -Wduplicated-cond -Wnull-dereference" \
  124. LD="$(TARGET_CC)" \
  125. LDFLAGS="$(TARGET_LDFLAGS) -latomic" \
  126. EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o"
  127. $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
  128. DESTDIR="$(PKG_INSTALL_DIR)" \
  129. LD="$(TARGET_CC)" \
  130. LDFLAGS="$(TARGET_LDFLAGS)" \
  131. $(MAKE_FLAGS) \
  132. install
  133. $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/contrib/halog \
  134. DESTDIR="$(PKG_INSTALL_DIR)" \
  135. $(MAKE_FLAGS) \
  136. OPTIMIZE="$(TARGET_CFLAGS)" \
  137. ADDLIB="-lcrypto" \
  138. halog
  139. endef
  140. define Package/haproxy/install
  141. $(INSTALL_DIR) $(1)/usr/sbin
  142. $(INSTALL_BIN) $(PKG_BUILD_DIR)/haproxy $(1)/usr/sbin/
  143. $(INSTALL_DIR) $(1)/etc
  144. $(INSTALL_CONF) ./files/haproxy.cfg $(1)/etc/
  145. $(INSTALL_DIR) $(1)/etc/init.d
  146. $(INSTALL_BIN) ./files/haproxy.init $(1)/etc/init.d/haproxy
  147. $(INSTALL_DIR) $(1)/etc/hotplug.d/net
  148. $(INSTALL_BIN) ./files/haproxy.hotplug $(1)/etc/hotplug.d/net/90-haproxy
  149. endef
  150. Package/haproxy-nossl/install = $(Package/haproxy/install)
  151. define Package/halog
  152. MENU:=1
  153. $(call Package/haproxy)
  154. TITLE+= halog
  155. DEPENDS:=haproxy
  156. endef
  157. define Package/halog/description
  158. HAProxy Log Analyzer
  159. endef
  160. define Package/halog/install
  161. $(INSTALL_DIR) $(1)/usr/bin
  162. $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/halog/halog $(1)/usr/bin/
  163. endef
  164. $(eval $(call Download,lua535))
  165. $(eval $(call BuildPackage,haproxy))
  166. $(eval $(call BuildPackage,halog))
  167. $(eval $(call BuildPackage,haproxy-nossl))