Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #
  2. # Copyright (C) 2006-2009 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.8l
  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:=05a0ece1372392a2cf310ebb96333025
  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
  30. Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
  31. protocols as well 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
  44. 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 += --with-cryptodev
  65. else
  66. OPENSSL_OPTIONS += no-engines
  67. endif
  68. ifdef CONFIG_arm
  69. OPENSSL_MAKEFLAGS := AES_ASM_OBJ="aes-armv4.o aes_cbc.o"
  70. else
  71. OPENSSL_OPTIONS += no-perlasm
  72. endif
  73. define Build/Configure
  74. (cd $(PKG_BUILD_DIR); \
  75. ./Configure linux-openwrt \
  76. --prefix=/usr \
  77. --openssldir=/etc/ssl \
  78. $(TARGET_CPPFLAGS) \
  79. $(TARGET_LDFLAGS) -ldl \
  80. -DOPENSSL_SMALL_FOOTPRINT \
  81. $(OPENSSL_NO_CIPHERS) \
  82. $(OPENSSL_OPTIONS) \
  83. )
  84. endef
  85. TARGET_CFLAGS += $(FPIC)
  86. define Build/Compile
  87. # XXX: OpenSSL "make depend" will look for installed headers before its own,
  88. # so remove installed stuff first
  89. -$(SUBMAKE) -j1 clean-staging
  90. $(MAKE) -C $(PKG_BUILD_DIR) \
  91. MAKEDEPPROG="$(TARGET_CROSS)gcc" \
  92. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  93. $(OPENSSL_MAKEFLAGS) \
  94. depend
  95. $(MAKE) -C $(PKG_BUILD_DIR) \
  96. CC="$(TARGET_CC)" \
  97. AR="$(TARGET_CROSS)ar r" \
  98. RANLIB="$(TARGET_CROSS)ranlib" \
  99. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  100. $(OPENSSL_MAKEFLAGS) \
  101. all build-shared
  102. # Work around openssl build bug to link libssl.so with libcrypto.so.
  103. -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
  104. $(MAKE) -C $(PKG_BUILD_DIR) \
  105. CC="$(TARGET_CC)" \
  106. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  107. $(OPENSSL_MAKEFLAGS) \
  108. do_linux-shared
  109. $(MAKE) -C $(PKG_BUILD_DIR) \
  110. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  111. $(OPENSSL_MAKEFLAGS) \
  112. install
  113. endef
  114. define Build/InstallDev
  115. mkdir -p $(1)/usr/include
  116. $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
  117. mkdir -p $(1)/usr/lib/
  118. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
  119. mkdir -p $(1)/usr/lib/pkgconfig
  120. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
  121. $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
  122. endef
  123. define Package/libopenssl/install
  124. $(INSTALL_DIR) $(1)/usr/lib
  125. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libcrypto.so.* $(1)/usr/lib/
  126. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libssl.so.* $(1)/usr/lib/
  127. endef
  128. define Package/openssl-util/install
  129. $(INSTALL_DIR) $(1)/etc/ssl
  130. $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
  131. $(INSTALL_DIR) $(1)/etc/ssl/certs
  132. $(INSTALL_DIR) $(1)/etc/ssl/private
  133. chmod 0700 $(1)/etc/ssl/private
  134. $(INSTALL_DIR) $(1)/usr/bin
  135. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
  136. endef
  137. $(eval $(call BuildPackage,libopenssl))
  138. $(eval $(call BuildPackage,openssl-util))