Makefile 4.4 KB

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