Makefile 4.4 KB

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