Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.8d
  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:=8ed1853538e1d05a1f5ada61ebf8bffa
  18. PKG_CAT:=zcat
  19. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
  20. PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
  21. include $(INCLUDE_DIR)/package.mk
  22. define Package/openssl/Default
  23. TITLE:=Open source SSL toolkit
  24. 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. URL:=http://www.openssl.org/
  30. endef
  31. define Package/libopenssl
  32. $(call Package/openssl/Default)
  33. SECTION:=libs
  34. CATEGORY:=Libraries
  35. DEPENDS:=+zlib
  36. TITLE+= (libraries)
  37. DESCRIPTION+=\\\
  38. \\\
  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. DESCRIPTION+=\\\
  49. \\\
  50. This package contains the OpenSSL command-line utility.
  51. endef
  52. define Package/openssl-util/conffiles
  53. /etc/ssl/openssl.cnf
  54. endef
  55. OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-rmd160 no-aes192
  56. OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-krb5 no-threads zlib-dynamic no-engines
  57. define Build/Configure
  58. (cd $(PKG_BUILD_DIR); \
  59. ./Configure linux-openwrt \
  60. --prefix=/usr \
  61. --openssldir=/etc/ssl \
  62. -I$(STAGING_DIR)/usr/include \
  63. -L$(STAGING_DIR)/usr/lib -ldl \
  64. -DOPENSSL_SMALL_FOOTPRINT \
  65. $(OPENSSL_NO_CIPHERS) \
  66. $(OPENSSL_OPTIONS) \
  67. )
  68. endef
  69. define Build/Compile
  70. rm -rf $(PKG_INSTALL_DIR)
  71. mkdir -p $(PKG_INSTALL_DIR)
  72. $(MAKE) -C $(PKG_BUILD_DIR) \
  73. MAKEDEPPROG="$(TARGET_CROSS)gcc" \
  74. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  75. depend
  76. $(MAKE) -C $(PKG_BUILD_DIR) \
  77. CC="$(TARGET_CC)" \
  78. AR="$(TARGET_CROSS)ar r" \
  79. RANLIB="$(TARGET_CROSS)ranlib" \
  80. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  81. all build-shared
  82. # Work around openssl build bug to link libssl.so with libcrypto.so.
  83. -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
  84. $(MAKE) -C $(PKG_BUILD_DIR) \
  85. CC="$(TARGET_CC)" \
  86. OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
  87. do_linux-shared
  88. $(MAKE) -C $(PKG_BUILD_DIR) \
  89. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  90. install
  91. endef
  92. define Build/InstallDev
  93. mkdir -p $(STAGING_DIR)/usr/include
  94. $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(STAGING_DIR)/usr/include/
  95. mkdir -p $(STAGING_DIR)/usr/lib/
  96. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(STAGING_DIR)/usr/lib/
  97. endef
  98. define Build/UninstallDev
  99. rm -rf $(STAGING_DIR)/usr/include/openssl \
  100. $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*}
  101. endef
  102. define Package/libopenssl/install
  103. install -d -m0755 $(1)/usr/lib
  104. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
  105. chmod 0644 $(1)/usr/lib/*
  106. endef
  107. define Package/openssl-util/install
  108. install -d -m0755 $(1)/etc/ssl
  109. $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
  110. install -d -m0755 $(1)/etc/ssl/certs
  111. install -d -m0755 $(1)/etc/ssl/private
  112. chmod 0700 $(1)/etc/ssl/private
  113. install -d -m0755 $(1)/usr/bin
  114. $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
  115. endef
  116. $(eval $(call BuildPackage,libopenssl))
  117. $(eval $(call BuildPackage,openssl-util))