Makefile 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. #
  2. # Copyright (C) 2007-2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=curl
  9. PKG_VERSION:=7.62.0
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=https://dl.uxnr.de/mirror/curl/ \
  13. https://curl.mirror.anstey.ca/ \
  14. https://curl.askapache.com/download/ \
  15. https://curl.haxx.se/download/
  16. PKG_HASH:=dab5643a5fe775ae92570b9f3df6b0ef4bc2a827a959361fb130c73b721275c1
  17. PKG_LICENSE:=MIT
  18. PKG_LICENSE_FILES:=COPYING
  19. PKG_CPE_ID:=cpe:/a:haxx:libcurl
  20. PKG_FIXUP:=autoreconf
  21. PKG_BUILD_PARALLEL:=1
  22. PKG_CONFIG_DEPENDS:= \
  23. CONFIG_IPV6 \
  24. \
  25. CONFIG_LIBCURL_WOLFSSL \
  26. CONFIG_LIBCURL_GNUTLS \
  27. CONFIG_LIBCURL_OPENSSL \
  28. CONFIG_LIBCURL_MBEDTLS \
  29. CONFIG_LIBCURL_NOSSL \
  30. \
  31. CONFIG_LIBCURL_LIBIDN2 \
  32. CONFIG_LIBCURL_SSH2 \
  33. CONFIG_LIBCURL_ZLIB \
  34. \
  35. CONFIG_LIBCURL_DICT \
  36. CONFIG_LIBCURL_FILE \
  37. CONFIG_LIBCURL_FTP \
  38. CONFIG_LIBCURL_GOPHER \
  39. CONFIG_LIBCURL_HTTP \
  40. CONFIG_LIBCURL_IMAP \
  41. CONFIG_LIBCURL_LDAP \
  42. CONFIG_LIBCURL_LDAPS \
  43. CONFIG_LIBCURL_POP3 \
  44. CONFIG_LIBCURL_RTSP \
  45. CONFIG_LIBCURL_NO_RTSP \
  46. CONFIG_LIBCURL_SMB \
  47. CONFIG_LIBCURL_NO_SMB \
  48. CONFIG_LIBCURL_SMTP \
  49. CONFIG_LIBCURL_TELNET \
  50. CONFIG_LIBCURL_TFTP \
  51. CONFIG_LIBCURL_NGHTTP2 \
  52. \
  53. CONFIG_LIBCURL_COOKIES \
  54. CONFIG_LIBCURL_CRYPTO_AUTH \
  55. CONFIG_LIBCURL_LIBCURL_OPTION \
  56. CONFIG_LIBCURL_PROXY \
  57. CONFIG_LIBCURL_THREADED_RESOLVER \
  58. CONFIG_LIBCURL_TLS_SRP \
  59. CONFIG_LIBCURL_UNIX_SOCKETS \
  60. CONFIG_LIBCURL_VERBOSE \
  61. CONFIG_LIBCURL_NTLM
  62. include $(INCLUDE_DIR)/package.mk
  63. define Package/curl/Default
  64. SECTION:=net
  65. CATEGORY:=Network
  66. URL:=http://curl.haxx.se/
  67. MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
  68. endef
  69. define Package/curl
  70. $(call Package/curl/Default)
  71. SUBMENU:=File Transfer
  72. DEPENDS:=+libcurl
  73. TITLE:=A client-side URL transfer utility
  74. endef
  75. define Package/libcurl
  76. $(call Package/curl/Default)
  77. SECTION:=libs
  78. CATEGORY:=Libraries
  79. DEPENDS:= +LIBCURL_WOLFSSL:libwolfssl +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls
  80. DEPENDS += +LIBCURL_ZLIB:zlib +LIBCURL_THREADED_RESOLVER:libpthread +LIBCURL_LDAP:libopenldap +LIBCURL_LIBIDN2:libidn2
  81. DEPENDS += +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 +ca-bundle
  82. TITLE:=A client-side URL transfer library
  83. MENU:=1
  84. endef
  85. define Package/libcurl/config
  86. source "$(SOURCE)/Config.in"
  87. endef
  88. TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections
  89. TARGET_CPPFLAGS += $(if $(CONFIG_LIBCURL_NTLM),,-DCURL_DISABLE_NTLM)
  90. TARGET_LDFLAGS += -Wl,--gc-sections
  91. CONFIGURE_ARGS += \
  92. --disable-debug \
  93. --disable-ares \
  94. --enable-shared \
  95. --enable-static \
  96. --disable-manual \
  97. --without-nss \
  98. --without-libmetalink \
  99. --without-librtmp \
  100. --without-libidn \
  101. --without-ca-path \
  102. --without-libpsl \
  103. --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
  104. \
  105. $(call autoconf_bool,CONFIG_IPV6,ipv6) \
  106. \
  107. $(if $(CONFIG_LIBCURL_WOLFSSL),--with-cyassl="$(STAGING_DIR)/usr",--without-cyassl) \
  108. $(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr",--without-gnutls) \
  109. $(if $(CONFIG_LIBCURL_OPENSSL),--with-ssl="$(STAGING_DIR)/usr",--without-ssl) \
  110. $(if $(CONFIG_LIBCURL_MBEDTLS),--with-mbedtls="$(STAGING_DIR)/usr",--without-mbedtls) \
  111. \
  112. $(if $(CONFIG_LIBCURL_LIBIDN2),--with-libidn2="$(STAGING_DIR)/usr",--without-libidn2) \
  113. $(if $(CONFIG_LIBCURL_SSH2),--with-libssh2="$(STAGING_DIR)/usr",--without-libssh2) \
  114. $(if $(CONFIG_LIBCURL_ZLIB),--with-zlib="$(STAGING_DIR)/usr",--without-zlib) \
  115. $(if $(CONFIG_LIBCURL_NGHTTP2),--with-nghttp2="$(STAGING_DIR)/usr",--without-nghttp2) \
  116. \
  117. $(call autoconf_bool,CONFIG_LIBCURL_DICT,dict) \
  118. $(call autoconf_bool,CONFIG_LIBCURL_FILE,file) \
  119. $(call autoconf_bool,CONFIG_LIBCURL_FTP,ftp) \
  120. $(call autoconf_bool,CONFIG_LIBCURL_GOPHER,gopher) \
  121. $(call autoconf_bool,CONFIG_LIBCURL_HTTP,http) \
  122. $(call autoconf_bool,CONFIG_LIBCURL_IMAP,imap) \
  123. $(call autoconf_bool,CONFIG_LIBCURL_LDAP,ldap) \
  124. $(call autoconf_bool,CONFIG_LIBCURL_LDAPS,ldaps) \
  125. $(call autoconf_bool,CONFIG_LIBCURL_POP3,pop3) \
  126. $(call autoconf_bool,CONFIG_LIBCURL_RTSP,rtsp) \
  127. $(call autoconf_bool,CONFIG_LIBCURL_SMB,smb) \
  128. $(call autoconf_bool,CONFIG_LIBCURL_SMTP,smtp) \
  129. $(call autoconf_bool,CONFIG_LIBCURL_TELNET,telnet) \
  130. $(call autoconf_bool,CONFIG_LIBCURL_TFTP,tftp) \
  131. \
  132. $(call autoconf_bool,CONFIG_LIBCURL_COOKIES,cookies) \
  133. $(call autoconf_bool,CONFIG_LIBCURL_CRYPTO_AUTH,crypto-auth) \
  134. $(call autoconf_bool,CONFIG_LIBCURL_LIBCURL_OPTION,libcurl-option) \
  135. $(call autoconf_bool,CONFIG_LIBCURL_PROXY,proxy) \
  136. $(call autoconf_bool,CONFIG_LIBCURL_THREADED_RESOLVER,threaded-resolver) \
  137. $(call autoconf_bool,CONFIG_LIBCURL_TLS_SRP,tls-srp) \
  138. $(call autoconf_bool,CONFIG_LIBCURL_UNIX_SOCKETS,unix-sockets) \
  139. $(call autoconf_bool,CONFIG_LIBCURL_VERBOSE,verbose) \
  140. define Build/Compile
  141. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  142. DESTDIR="$(PKG_INSTALL_DIR)" \
  143. CC="$(TARGET_CC)" \
  144. install
  145. endef
  146. define Build/InstallDev
  147. $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
  148. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl-config $(1)/usr/bin/
  149. $(CP) $(PKG_INSTALL_DIR)/usr/include/curl $(1)/usr/include/
  150. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.{a,so*} $(1)/usr/lib/
  151. $(CP) $(PKG_BUILD_DIR)/libcurl.pc $(1)/usr/lib/pkgconfig/
  152. $(SED) 's,-L$$$${exec_prefix}/lib,,g' $(1)/usr/bin/curl-config
  153. [ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/libcurl.pc || true
  154. $(LN) $(STAGING_DIR)/usr/bin/curl-config $(2)/bin/
  155. endef
  156. define Package/curl/install
  157. $(INSTALL_DIR) $(1)/usr/bin
  158. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl $(1)/usr/bin/
  159. endef
  160. define Package/libcurl/install
  161. $(INSTALL_DIR) $(1)/usr/lib
  162. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.so.* $(1)/usr/lib/
  163. endef
  164. $(eval $(call BuildPackage,curl))
  165. $(eval $(call BuildPackage,libcurl))