Makefile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #
  2. # Copyright (C) 2006-2012 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:=openssl
  9. PKG_VERSION:=1.0.1c
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://www.openssl.org/source/ \
  13. ftp://ftp.funet.fi/pub/crypt/cryptography/libs/openssl/source/ \
  14. ftp://ftp.webmonster.de/pub/openssl/source/ \
  15. ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
  16. PKG_MD5SUM:=ae412727c8c15b67880aef7bd2999b2e
  17. PKG_BUILD_DEPENDS:=ocf-crypto-headers
  18. PKG_CONFIG_DEPENDS:=CONFIG_OPENSSL_ENGINE
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/openssl/Default
  21. TITLE:=Open source SSL toolkit
  22. URL:=http://www.openssl.org/
  23. endef
  24. define Package/libopenssl/config
  25. source "$(SOURCE)/Config.in"
  26. endef
  27. define Package/openssl/Default/description
  28. The OpenSSL Project is a collaborative effort to develop a robust,
  29. commercial-grade, full-featured, and Open Source toolkit implementing the Secure
  30. Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well
  31. as a full-strength general purpose cryptography library.
  32. endef
  33. define Package/libopenssl
  34. $(call Package/openssl/Default)
  35. SECTION:=libs
  36. SUBMENU:=SSL
  37. CATEGORY:=Libraries
  38. DEPENDS:=+zlib
  39. TITLE+= (libraries)
  40. MENU:=1
  41. endef
  42. define Package/libopenssl/description
  43. $(call Package/openssl/Default/description)
  44. This package contains the OpenSSL shared libraries, needed by other programs.
  45. endef
  46. define Package/openssl-util
  47. $(call Package/openssl/Default)
  48. SECTION:=utils
  49. CATEGORY:=Utilities
  50. DEPENDS:=+libopenssl
  51. TITLE+= (utility)
  52. endef
  53. define Package/openssl-util/conffiles
  54. /etc/ssl/openssl.cnf
  55. endef
  56. define Package/openssl-util/description
  57. $(call Package/openssl/Default/description)
  58. This package contains the OpenSSL command-line utility.
  59. endef
  60. OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
  61. no-rmd160 no-aes192 no-ripemd no-camellia no-ans1 no-krb5
  62. OPENSSL_OPTIONS:= shared no-ec no-err no-hw no-threads zlib-dynamic no-sse2
  63. ifdef CONFIG_OPENSSL_ENGINE
  64. OPENSSL_OPTIONS += -DHAVE_CRYPTODEV
  65. else
  66. OPENSSL_OPTIONS += no-engines
  67. endif
  68. OPENSSL_OPTIONS += no-perlasm
  69. define Build/Configure
  70. (cd $(PKG_BUILD_DIR); \
  71. ./Configure linux-openwrt \
  72. --prefix=/usr \
  73. --openssldir=/etc/ssl \
  74. $(TARGET_CPPFLAGS) \
  75. $(TARGET_LDFLAGS) -ldl \
  76. -DOPENSSL_SMALL_FOOTPRINT \
  77. $(OPENSSL_NO_CIPHERS) \
  78. $(OPENSSL_OPTIONS) \
  79. )
  80. endef
  81. TARGET_CFLAGS += $(FPIC)
  82. define Build/Compile
  83. # XXX: OpenSSL "make depend" will look for installed headers before its own,
  84. # so remove installed stuff first
  85. -$(SUBMAKE) -j1 clean-staging
  86. $(MAKE) -C $(PKG_BUILD_DIR) \
  87. MAKEDEPPROG="$(TARGET_CROSS)gcc" \
  88. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  89. $(OPENSSL_MAKEFLAGS) \
  90. depend
  91. $(_SINGLE)$(MAKE) -C $(PKG_BUILD_DIR) \
  92. CC="$(TARGET_CC)" \
  93. AR="$(TARGET_CROSS)ar r" \
  94. RANLIB="$(TARGET_CROSS)ranlib" \
  95. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  96. $(OPENSSL_MAKEFLAGS) \
  97. all
  98. $(MAKE) -C $(PKG_BUILD_DIR) \
  99. CC="$(TARGET_CC)" \
  100. AR="$(TARGET_CROSS)ar r" \
  101. RANLIB="$(TARGET_CROSS)ranlib" \
  102. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  103. $(OPENSSL_MAKEFLAGS) \
  104. build-shared
  105. # Work around openssl build bug to link libssl.so with libcrypto.so.
  106. -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
  107. $(MAKE) -C $(PKG_BUILD_DIR) \
  108. CC="$(TARGET_CC)" \
  109. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  110. $(OPENSSL_MAKEFLAGS) \
  111. do_linux-shared
  112. $(MAKE) -C $(PKG_BUILD_DIR) \
  113. CC="$(TARGET_CC)" \
  114. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  115. $(OPENSSL_MAKEFLAGS) \
  116. install
  117. endef
  118. define Build/InstallDev
  119. $(INSTALL_DIR) $(1)/usr/include
  120. $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
  121. $(INSTALL_DIR) $(1)/usr/lib/
  122. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
  123. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  124. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
  125. [ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc || true
  126. endef
  127. define Package/libopenssl/install
  128. $(INSTALL_DIR) $(1)/usr/lib
  129. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libcrypto.so.* $(1)/usr/lib/
  130. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libssl.so.* $(1)/usr/lib/
  131. endef
  132. define Package/openssl-util/install
  133. $(INSTALL_DIR) $(1)/etc/ssl
  134. $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
  135. $(INSTALL_DIR) $(1)/etc/ssl/certs
  136. $(INSTALL_DIR) $(1)/etc/ssl/private
  137. chmod 0700 $(1)/etc/ssl/private
  138. $(INSTALL_DIR) $(1)/usr/bin
  139. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
  140. endef
  141. $(eval $(call BuildPackage,libopenssl))
  142. $(eval $(call BuildPackage,openssl-util))