Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #
  2. # Copyright (C) 2006 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.8h
  11. PKG_RELEASE:=1
  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:=7d3d41dafc76cf2fcb5559963b5783b3
  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. CATEGORY:=Libraries
  33. DEPENDS:=+zlib
  34. TITLE+= (libraries)
  35. endef
  36. define Package/libopenssl/description
  37. $(call Package/openssl/Default/description)
  38. This package contains the OpenSSL shared libraries, needed by other
  39. programs.
  40. endef
  41. define Package/openssl-util
  42. $(call Package/openssl/Default)
  43. SECTION:=utils
  44. CATEGORY:=Utilities
  45. DEPENDS:=+libopenssl
  46. TITLE+= (utility)
  47. endef
  48. define Package/openssl-util/conffiles
  49. /etc/ssl/openssl.cnf
  50. endef
  51. define Package/openssl-util/description
  52. $(call Package/openssl/Default/description)
  53. This package contains the OpenSSL command-line utility.
  54. endef
  55. OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc2 no-rc5 no-sha0 no-smime \
  56. no-rmd160 no-aes192 no-ripemd no-camellia no-ans1 no-krb5
  57. ifeq ($(BOARD),ixp4xx)
  58. OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-threads zlib-dynamic \
  59. no-sse2 no-perlasm --with-cryptodev
  60. else
  61. OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-threads zlib-dynamic \
  62. no-engines no-sse2 no-perlasm
  63. endif
  64. define Build/Configure
  65. (cd $(PKG_BUILD_DIR); \
  66. ./Configure linux-openwrt \
  67. --prefix=/usr \
  68. --openssldir=/etc/ssl \
  69. $(TARGET_CPPFLAGS) \
  70. $(TARGET_LDFLAGS) -ldl \
  71. -DOPENSSL_SMALL_FOOTPRINT \
  72. $(OPENSSL_NO_CIPHERS) \
  73. $(OPENSSL_OPTIONS) \
  74. )
  75. endef
  76. TARGET_CFLAGS += $(FPIC)
  77. define Build/Compile
  78. rm -rf $(PKG_INSTALL_DIR)
  79. mkdir -p $(PKG_INSTALL_DIR)
  80. $(MAKE) -C $(PKG_BUILD_DIR) \
  81. MAKEDEPPROG="$(TARGET_CROSS)gcc" \
  82. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  83. depend
  84. $(MAKE) -C $(PKG_BUILD_DIR) \
  85. CC="$(TARGET_CC)" \
  86. AR="$(TARGET_CROSS)ar r" \
  87. RANLIB="$(TARGET_CROSS)ranlib" \
  88. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  89. all build-shared
  90. # Work around openssl build bug to link libssl.so with libcrypto.so.
  91. -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
  92. $(MAKE) -C $(PKG_BUILD_DIR) \
  93. CC="$(TARGET_CC)" \
  94. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  95. do_linux-shared
  96. $(MAKE) -C $(PKG_BUILD_DIR) \
  97. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  98. install
  99. endef
  100. define Build/InstallDev
  101. mkdir -p $(1)/usr/include
  102. $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
  103. mkdir -p $(1)/usr/lib/
  104. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
  105. mkdir -p $(1)/usr/lib/pkgconfig
  106. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
  107. $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
  108. endef
  109. define Package/libopenssl/install
  110. $(INSTALL_DIR) $(1)/usr/lib
  111. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
  112. chmod 0644 $(1)/usr/lib/*
  113. endef
  114. define Package/openssl-util/install
  115. $(INSTALL_DIR) $(1)/etc/ssl
  116. $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
  117. $(INSTALL_DIR) $(1)/etc/ssl/certs
  118. $(INSTALL_DIR) $(1)/etc/ssl/private
  119. chmod 0700 $(1)/etc/ssl/private
  120. $(INSTALL_DIR) $(1)/usr/bin
  121. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
  122. endef
  123. $(eval $(call BuildPackage,libopenssl))
  124. $(eval $(call BuildPackage,openssl-util))