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.

197 lines
5.4 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.10
  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:=1d38ab3dd45e930b209e922a360ee8c636103e21e5b5a2656d3795401316a4ea
  16. PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>, \
  17. Christian Lachner <gladiac@gmail.com>
  18. PKG_LICENSE:=GPL-2.0-only
  19. PKG_LICENSE_FILES:=LICENSE
  20. PKG_CPE_ID:=cpe:/a:haproxy:haproxy
  21. include $(INCLUDE_DIR)/package.mk
  22. define Package/haproxy/Default
  23. SUBMENU:=Web Servers/Proxies
  24. SECTION:=net
  25. CATEGORY:=Network
  26. TITLE:=The Reliable, High Performance TCP/HTTP Load Balancer
  27. URL:=https://www.haproxy.org/
  28. endef
  29. define Download/lua535
  30. FILE:=lua-5.3.5.tar.gz
  31. URL:=https://www.lua.org/ftp/
  32. HASH:=0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac
  33. endef
  34. define Build/Prepare
  35. $(call Build/Prepare/Default)
  36. ifeq ($(ENABLE_LUA),y)
  37. tar -zxvf $(DL_DIR)/lua-5.3.5.tar.gz -C $(PKG_BUILD_DIR)
  38. ln -s $(PKG_BUILD_DIR)/lua-5.3.5 $(PKG_BUILD_DIR)/lua
  39. endif
  40. endef
  41. define Package/haproxy/Default/conffiles
  42. /etc/haproxy.cfg
  43. endef
  44. define Package/haproxy/Default/description
  45. Open source Reliable, High Performance TCP/HTTP Load Balancer.
  46. endef
  47. define Package/haproxy
  48. DEPENDS+= +libpcre +libltdl +zlib +libpthread +libopenssl +libncurses +libreadline +libatomic
  49. TITLE+= (with SSL support)
  50. VARIANT:=ssl
  51. $(call Package/haproxy/Default)
  52. endef
  53. define Package/haproxy/conffiles
  54. $(call Package/haproxy/Default/conffiles)
  55. endef
  56. define Package/haproxy/description
  57. $(call Package/haproxy/Default/description)
  58. This package is built with SSL and LUA support.
  59. endef
  60. define Package/haproxy-nossl
  61. TITLE+= (without SSL support)
  62. VARIANT:=nossl
  63. DEPENDS+= +libpcre +libltdl +zlib +libpthread +libatomic
  64. TITLE+= (without SSL support)
  65. $(call Package/haproxy/Default)
  66. endef
  67. define Package/haproxy-nossl/conffiles
  68. $(call Package/haproxy/Default/conffiles)
  69. endef
  70. define Package/haproxy-nossl/description
  71. $(call Package/haproxy/Default/description)
  72. This package is built without SSL support.
  73. endef
  74. ENABLE_LUA:=y
  75. ENABLE_REGPARM:=n
  76. ifeq ($(CONFIG_TARGET_x86),y)
  77. ENABLE_REGPARM:=y
  78. endif
  79. ifeq ($(CONFIG_USE_UCLIBC),y)
  80. LINUX_TARGET:=linux-uclibc
  81. else
  82. LINUX_TARGET:=linux-glibc
  83. endif
  84. ifeq ($(BUILD_VARIANT),ssl)
  85. ADDON+=USE_OPENSSL=1
  86. ADDON+=ADDLIB="-lcrypto -lm "
  87. endif
  88. ifeq ($(ENABLE_LUA),y)
  89. ADDON+=USE_LUA=1
  90. ADDON+=LUA_LIB_NAME="lua535"
  91. ADDON+=LUA_INC="$(STAGING_DIR)/lua-5.3.5/include"
  92. ADDON+=LUA_LIB="$(STAGING_DIR)/lua-5.3.5/lib"
  93. endif
  94. ifeq ($(ENABLE_REGPARM),y)
  95. ADDON+=USE_REGPARM=1
  96. endif
  97. ifeq ($(ENABLE_LUA),y)
  98. define Build/Compile/lua
  99. $(MAKE) TARGET=$(LINUX_TARGET) -C $(PKG_BUILD_DIR)/lua \
  100. INSTALL_TOP="$(STAGING_DIR)/lua-5.3.5/" \
  101. CC="$(TARGET_CC)" \
  102. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  103. LDFLAGS="$(TARGET_LDFLAGS) -lncurses -lreadline" \
  104. LD="$(TARGET_LD)" \
  105. linux install
  106. mv $(STAGING_DIR)/lua-5.3.5/lib/liblua.a $(STAGING_DIR)/lua-5.3.5/lib/liblua535.a
  107. endef
  108. endif
  109. define Build/Compile
  110. $(call Build/Compile/lua)
  111. $(MAKE) TARGET=$(LINUX_TARGET) -C $(PKG_BUILD_DIR) \
  112. DESTDIR="$(PKG_INSTALL_DIR)" \
  113. CC="$(TARGET_CC)" \
  114. PCREDIR="$(STAGING_DIR)/usr/" \
  115. SMALL_OPTS="-DBUFSIZE=16384 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=165530" \
  116. USE_LINUX_TPROXY=1 USE_LINUX_SPLICE=1 USE_TFO=1 USE_NS=1 \
  117. USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_GETADDRINFO=1 \
  118. USE_THREAD=1 USE_PTHREAD_PSHARED=1 \
  119. VERSION="$(PKG_VERSION)" SUBVERS="-$(PKG_RELEASE)" \
  120. VERDATE="$(shell date -d @$(SOURCE_DATE_EPOCH) '+%Y/%m/%d')" IGNOREGIT=1 \
  121. $(ADDON) \
  122. 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" \
  123. LD="$(TARGET_CC)" \
  124. LDFLAGS="$(TARGET_LDFLAGS) -latomic" \
  125. EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o"
  126. $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
  127. DESTDIR="$(PKG_INSTALL_DIR)" \
  128. LD="$(TARGET_CC)" \
  129. LDFLAGS="$(TARGET_LDFLAGS)" \
  130. $(MAKE_FLAGS) \
  131. install
  132. $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/contrib/halog \
  133. DESTDIR="$(PKG_INSTALL_DIR)" \
  134. $(MAKE_FLAGS) \
  135. OPTIMIZE="$(TARGET_CFLAGS)" \
  136. ADDLIB="-lcrypto" \
  137. halog
  138. endef
  139. define Package/haproxy/install
  140. $(INSTALL_DIR) $(1)/usr/sbin
  141. $(INSTALL_BIN) $(PKG_BUILD_DIR)/haproxy $(1)/usr/sbin/
  142. $(INSTALL_DIR) $(1)/etc
  143. $(INSTALL_CONF) ./files/haproxy.cfg $(1)/etc/
  144. $(INSTALL_DIR) $(1)/etc/init.d
  145. $(INSTALL_BIN) ./files/haproxy.init $(1)/etc/init.d/haproxy
  146. endef
  147. Package/haproxy-nossl/install = $(Package/haproxy/install)
  148. define Package/halog
  149. MENU:=1
  150. $(call Package/haproxy)
  151. TITLE+= halog
  152. DEPENDS:=haproxy
  153. endef
  154. define Package/halog/description
  155. HAProxy Log Analyzer
  156. endef
  157. define Package/halog/install
  158. $(INSTALL_DIR) $(1)/usr/bin
  159. $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/halog/halog $(1)/usr/bin/
  160. endef
  161. $(eval $(call Download,lua535))
  162. $(eval $(call BuildPackage,haproxy))
  163. $(eval $(call BuildPackage,halog))
  164. $(eval $(call BuildPackage,haproxy-nossl))