Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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:=2017.75
  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:=e57e9b9d25705dcb073ba15c416424fd
  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. # remove protocol idented software version number
  87. $(SED) 's,^#define LOCAL_IDENT .*$$$$,#define LOCAL_IDENT "SSH-2.0-dropbear",g' \
  88. $(PKG_BUILD_DIR)/sysoptions.h
  89. # Enforce rebuild of svr-chansession.c
  90. rm -f $(PKG_BUILD_DIR)/svr-chansession.o
  91. endef
  92. define Build/Compile
  93. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  94. $(TARGET_CONFIGURE_OPTS) \
  95. PROGRAMS="dropbear dbclient dropbearkey scp" \
  96. MULTI=1 SCPPROGRESS=1
  97. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  98. $(TARGET_CONFIGURE_OPTS) \
  99. PROGRAMS="dropbearconvert"
  100. endef
  101. define Package/dropbear/install
  102. $(INSTALL_DIR) $(1)/usr/sbin
  103. $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
  104. $(INSTALL_DIR) $(1)/usr/bin
  105. $(LN) ../sbin/dropbear $(1)/usr/bin/scp
  106. $(LN) ../sbin/dropbear $(1)/usr/bin/ssh
  107. $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
  108. $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
  109. $(INSTALL_DIR) $(1)/etc/config
  110. $(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
  111. $(INSTALL_DIR) $(1)/etc/init.d
  112. $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
  113. $(INSTALL_DIR) $(1)/usr/lib/opkg/info
  114. $(INSTALL_DIR) $(1)/etc/dropbear
  115. touch $(1)/etc/dropbear/dropbear_rsa_host_key
  116. endef
  117. define Package/dropbearconvert/install
  118. $(INSTALL_DIR) $(1)/usr/bin
  119. $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
  120. endef
  121. $(eval $(call BuildPackage,dropbear))
  122. $(eval $(call BuildPackage,dropbearconvert))