Makefile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #
  2. # Copyright (C) 2006-2008 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. # $Id$
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=openssl
  10. PKG_VERSION:=0.9.8i
  11. PKG_RELEASE:=3
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=http://www.openssl.org/source/ \
  14. ftp://ftp.funet.fi/pub/crypt/cryptography/libs/openssl/source/ \
  15. ftp://ftp.webmonster.de/pub/openssl/source/ \
  16. ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
  17. PKG_MD5SUM:=561e00f18821c74b2b86c8c7786f9d8b
  18. PKG_BUILD_DEPENDS:=ocf-crypto-headers
  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/openssl/Default/description
  25. The OpenSSL Project is a collaborative effort to develop a robust,
  26. commercial-grade, full-featured, and Open Source toolkit implementing the
  27. Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
  28. protocols as well as a full-strength general purpose cryptography library.
  29. endef
  30. define Package/libopenssl
  31. $(call Package/openssl/Default)
  32. SECTION:=libs
  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-fips no-hw no-threads zlib-dynamic \
  60. no-sse2 no-perlasm --with-cryptodev
  61. else
  62. OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-threads zlib-dynamic \
  63. no-engines no-sse2 no-perlasm
  64. endif
  65. define Build/Configure
  66. (cd $(PKG_BUILD_DIR); \
  67. ./Configure linux-openwrt \
  68. --prefix=/usr \
  69. --openssldir=/etc/ssl \
  70. $(TARGET_CPPFLAGS) \
  71. $(TARGET_LDFLAGS) -ldl \
  72. -DOPENSSL_SMALL_FOOTPRINT \
  73. $(OPENSSL_NO_CIPHERS) \
  74. $(OPENSSL_OPTIONS) \
  75. )
  76. endef
  77. TARGET_CFLAGS += $(FPIC)
  78. define Build/Compile
  79. rm -rf $(PKG_INSTALL_DIR)
  80. mkdir -p $(PKG_INSTALL_DIR)
  81. $(MAKE) -C $(PKG_BUILD_DIR) \
  82. MAKEDEPPROG="$(TARGET_CROSS)gcc" \
  83. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  84. depend
  85. $(MAKE) -C $(PKG_BUILD_DIR) \
  86. CC="$(TARGET_CC)" \
  87. AR="$(TARGET_CROSS)ar r" \
  88. RANLIB="$(TARGET_CROSS)ranlib" \
  89. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  90. all build-shared
  91. # Work around openssl build bug to link libssl.so with libcrypto.so.
  92. -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
  93. $(MAKE) -C $(PKG_BUILD_DIR) \
  94. CC="$(TARGET_CC)" \
  95. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  96. do_linux-shared
  97. $(MAKE) -C $(PKG_BUILD_DIR) \
  98. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  99. install
  100. endef
  101. define Build/InstallDev
  102. mkdir -p $(1)/usr/include
  103. $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
  104. mkdir -p $(1)/usr/lib/
  105. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
  106. mkdir -p $(1)/usr/lib/pkgconfig
  107. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
  108. $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
  109. endef
  110. define Package/libopenssl/install
  111. $(INSTALL_DIR) $(1)/usr/lib
  112. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
  113. chmod 0644 $(1)/usr/lib/*
  114. endef
  115. define Package/openssl-util/install
  116. $(INSTALL_DIR) $(1)/etc/ssl
  117. $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
  118. $(INSTALL_DIR) $(1)/etc/ssl/certs
  119. $(INSTALL_DIR) $(1)/etc/ssl/private
  120. chmod 0700 $(1)/etc/ssl/private
  121. $(INSTALL_DIR) $(1)/usr/bin
  122. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
  123. endef
  124. $(eval $(call BuildPackage,libopenssl))
  125. $(eval $(call BuildPackage,openssl-util))