Makefile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #
  2. # Copyright (C) 2006-2010 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:=0.9.8m
  10. PKG_RELEASE:=2
  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:=898bf125370926d5f692a2201124f8ec
  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. endef
  41. define Package/libopenssl/description
  42. $(call Package/openssl/Default/description)
  43. This package contains the OpenSSL shared libraries, needed by other programs.
  44. endef
  45. define Package/openssl-util
  46. $(call Package/openssl/Default)
  47. SECTION:=utils
  48. CATEGORY:=Utilities
  49. DEPENDS:=+libopenssl
  50. TITLE+= (utility)
  51. endef
  52. define Package/openssl-util/conffiles
  53. /etc/ssl/openssl.cnf
  54. endef
  55. define Package/openssl-util/description
  56. $(call Package/openssl/Default/description)
  57. This package contains the OpenSSL command-line utility.
  58. endef
  59. OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
  60. no-rmd160 no-aes192 no-ripemd no-camellia no-ans1 no-krb5
  61. OPENSSL_OPTIONS:= shared no-ec no-err no-hw no-threads zlib-dynamic no-sse2
  62. ifdef CONFIG_OPENSSL_ENGINE
  63. OPENSSL_OPTIONS += --with-cryptodev
  64. else
  65. OPENSSL_OPTIONS += no-engines
  66. endif
  67. OPENSSL_OPTIONS += no-perlasm
  68. define Build/Configure
  69. (cd $(PKG_BUILD_DIR); \
  70. ./Configure linux-openwrt \
  71. --prefix=/usr \
  72. --openssldir=/etc/ssl \
  73. $(TARGET_CPPFLAGS) \
  74. $(TARGET_LDFLAGS) -ldl \
  75. -DOPENSSL_SMALL_FOOTPRINT \
  76. $(OPENSSL_NO_CIPHERS) \
  77. $(OPENSSL_OPTIONS) \
  78. )
  79. endef
  80. TARGET_CFLAGS += $(FPIC)
  81. define Build/Compile
  82. # XXX: OpenSSL "make depend" will look for installed headers before its own,
  83. # so remove installed stuff first
  84. -$(SUBMAKE) -j1 clean-staging
  85. $(MAKE) -C $(PKG_BUILD_DIR) \
  86. MAKEDEPPROG="$(TARGET_CROSS)gcc" \
  87. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  88. $(OPENSSL_MAKEFLAGS) \
  89. depend
  90. $(_SINGLE)$(MAKE) -C $(PKG_BUILD_DIR) \
  91. CC="$(TARGET_CC)" \
  92. AR="$(TARGET_CROSS)ar r" \
  93. RANLIB="$(TARGET_CROSS)ranlib" \
  94. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  95. $(OPENSSL_MAKEFLAGS) \
  96. all
  97. $(MAKE) -C $(PKG_BUILD_DIR) \
  98. CC="$(TARGET_CC)" \
  99. AR="$(TARGET_CROSS)ar r" \
  100. RANLIB="$(TARGET_CROSS)ranlib" \
  101. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  102. $(OPENSSL_MAKEFLAGS) \
  103. build-shared
  104. # Work around openssl build bug to link libssl.so with libcrypto.so.
  105. -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
  106. $(MAKE) -C $(PKG_BUILD_DIR) \
  107. CC="$(TARGET_CC)" \
  108. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  109. $(OPENSSL_MAKEFLAGS) \
  110. do_linux-shared
  111. $(MAKE) -C $(PKG_BUILD_DIR) \
  112. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  113. $(OPENSSL_MAKEFLAGS) \
  114. install
  115. endef
  116. define Build/InstallDev
  117. $(INSTALL_DIR) $(1)/usr/include
  118. $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
  119. $(INSTALL_DIR) $(1)/usr/lib/
  120. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
  121. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  122. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
  123. $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
  124. endef
  125. define Package/libopenssl/install
  126. $(INSTALL_DIR) $(1)/usr/lib
  127. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libcrypto.so.* $(1)/usr/lib/
  128. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libssl.so.* $(1)/usr/lib/
  129. endef
  130. define Package/openssl-util/install
  131. $(INSTALL_DIR) $(1)/etc/ssl
  132. $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
  133. $(INSTALL_DIR) $(1)/etc/ssl/certs
  134. $(INSTALL_DIR) $(1)/etc/ssl/private
  135. chmod 0700 $(1)/etc/ssl/private
  136. $(INSTALL_DIR) $(1)/usr/bin
  137. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
  138. endef
  139. $(eval $(call BuildPackage,libopenssl))
  140. $(eval $(call BuildPackage,openssl-util))