Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #
  2. # Copyright (C) 2006-2016 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:=dropbear
  9. PKG_VERSION:=2016.74
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:= \
  13. http://matt.ucc.asn.au/dropbear/releases/ \
  14. https://dropbear.nl/mirror/releases/
  15. PKG_MD5SUM:=9ad0172731e0f16623937804643b5bd8
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
  18. PKG_BUILD_PARALLEL:=1
  19. PKG_USE_MIPS16:=0
  20. PKG_CONFIG_DEPENDS:=CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_CURVE25519
  21. include $(INCLUDE_DIR)/package.mk
  22. ifneq ($(DUMP),1)
  23. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s)
  24. endif
  25. define Package/dropbear/Default
  26. URL:=http://matt.ucc.asn.au/dropbear/
  27. endef
  28. define Package/dropbear/config
  29. source "$(SOURCE)/Config.in"
  30. endef
  31. define Package/dropbear
  32. $(call Package/dropbear/Default)
  33. SECTION:=net
  34. CATEGORY:=Base system
  35. TITLE:=Small SSH2 client/server
  36. endef
  37. define Package/dropbear/description
  38. A small SSH2 server/client designed for small memory environments.
  39. endef
  40. define Package/dropbear/conffiles
  41. /etc/dropbear/dropbear_rsa_host_key
  42. /etc/config/dropbear
  43. endef
  44. define Package/dropbearconvert
  45. $(call Package/dropbear/Default)
  46. SECTION:=utils
  47. CATEGORY:=Utilities
  48. TITLE:=Utility for converting SSH keys
  49. endef
  50. CONFIGURE_ARGS += \
  51. --disable-pam \
  52. --enable-openpty \
  53. --enable-syslog \
  54. $(if $(CONFIG_SHADOW_PASSWORDS),,--disable-shadow) \
  55. --disable-lastlog \
  56. $(if $(CONFIG_DROPBEAR_UTMP),,--disable-utmp) \
  57. --disable-wtmp \
  58. --disable-wtmpx \
  59. --disable-loginfunc \
  60. $(if $(CONFIG_DROPBEAR_PUTUTLINE),,--disable-pututline) \
  61. --disable-pututxline \
  62. --disable-zlib \
  63. --enable-bundled-libtom
  64. TARGET_CFLAGS += -DDEFAULT_PATH=\\\"$(TARGET_INIT_PATH)\\\" -DARGTYPE=3 -ffunction-sections -fdata-sections
  65. TARGET_LDFLAGS += -Wl,--gc-sections
  66. define Build/Configure
  67. $(Build/Configure/Default)
  68. $(SED) 's,^#define DEFAULT_PATH .*$$$$,#define DEFAULT_PATH "$(TARGET_INIT_PATH)",g' \
  69. $(PKG_BUILD_DIR)/options.h
  70. awk 'BEGIN { rc = 1 } \
  71. /'DROPBEAR_CURVE25519'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_CURVE25519),,// )#define 'DROPBEAR_CURVE25519'"; rc = 0 } \
  72. { print } \
  73. END { exit(rc) }' $(PKG_BUILD_DIR)/options.h \
  74. >$(PKG_BUILD_DIR)/options.h.new && \
  75. mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h
  76. # Enforce that all replacements are made, otherwise options.h has changed
  77. # format and this logic is broken.
  78. for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH; do \
  79. awk 'BEGIN { rc = 1 } \
  80. /'$$$$OPTION'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_ECC),,// )#define '$$$$OPTION'"; rc = 0 } \
  81. { print } \
  82. END { exit(rc) }' $(PKG_BUILD_DIR)/options.h \
  83. >$(PKG_BUILD_DIR)/options.h.new && \
  84. mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h || exit 1; \
  85. done
  86. # Enforce rebuild of svr-chansession.c
  87. rm -f $(PKG_BUILD_DIR)/svr-chansession.o
  88. endef
  89. define Build/Compile
  90. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  91. $(TARGET_CONFIGURE_OPTS) \
  92. PROGRAMS="dropbear dbclient dropbearkey scp" \
  93. MULTI=1 SCPPROGRESS=1
  94. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  95. $(TARGET_CONFIGURE_OPTS) \
  96. PROGRAMS="dropbearconvert"
  97. endef
  98. define Package/dropbear/install
  99. $(INSTALL_DIR) $(1)/usr/sbin
  100. $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
  101. $(INSTALL_DIR) $(1)/usr/bin
  102. $(LN) ../sbin/dropbear $(1)/usr/bin/scp
  103. $(LN) ../sbin/dropbear $(1)/usr/bin/ssh
  104. $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
  105. $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
  106. $(INSTALL_DIR) $(1)/etc/config
  107. $(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
  108. $(INSTALL_DIR) $(1)/etc/init.d
  109. $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
  110. $(INSTALL_DIR) $(1)/usr/lib/opkg/info
  111. $(INSTALL_DIR) $(1)/etc/dropbear
  112. touch $(1)/etc/dropbear/dropbear_rsa_host_key
  113. endef
  114. define Package/dropbearconvert/install
  115. $(INSTALL_DIR) $(1)/usr/bin
  116. $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
  117. endef
  118. $(eval $(call BuildPackage,dropbear))
  119. $(eval $(call BuildPackage,dropbearconvert))