Makefile 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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:=2019.78
  10. PKG_RELEASE:=2
  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:=525965971272270995364a0eb01f35180d793182e63dd0b0c3eb0292291644a4
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
  18. PKG_CPE_ID:=cpe:/a:matt_johnston:dropbear_ssh_server
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_USE_MIPS16:=0
  21. PKG_FIXUP:=autoreconf
  22. PKG_CONFIG_DEPENDS:= \
  23. CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
  24. CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
  25. CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
  26. CONFIG_DROPBEAR_DBCLIENT
  27. include $(INCLUDE_DIR)/package.mk
  28. ifneq ($(DUMP),1)
  29. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5)
  30. endif
  31. define Package/dropbear/Default
  32. URL:=http://matt.ucc.asn.au/dropbear/
  33. endef
  34. define Package/dropbear/config
  35. source "$(SOURCE)/Config.in"
  36. endef
  37. define Package/dropbear
  38. $(call Package/dropbear/Default)
  39. SECTION:=net
  40. CATEGORY:=Base system
  41. TITLE:=Small SSH2 client/server
  42. DEPENDS:= +DROPBEAR_ZLIB:zlib
  43. ALTERNATIVES:=\
  44. 100:/usr/bin/ssh:/usr/sbin/dropbear \
  45. 100:/usr/bin/scp:/usr/sbin/dropbear \
  46. endef
  47. define Package/dropbear/description
  48. A small SSH2 server/client designed for small memory environments.
  49. endef
  50. define Package/dropbear/conffiles
  51. $(if $(CONFIG_DROPBEAR_ECC),/etc/dropbear/dropbear_ecdsa_host_key)
  52. /etc/dropbear/dropbear_rsa_host_key
  53. /etc/config/dropbear
  54. endef
  55. define Package/dropbearconvert
  56. $(call Package/dropbear/Default)
  57. SECTION:=utils
  58. CATEGORY:=Utilities
  59. TITLE:=Utility for converting SSH keys
  60. endef
  61. CONFIGURE_ARGS += \
  62. --disable-pam \
  63. --enable-openpty \
  64. --enable-syslog \
  65. --disable-lastlog \
  66. --disable-utmpx \
  67. $(if $(CONFIG_DROPBEAR_UTMP),,--disable-utmp) \
  68. --disable-wtmp \
  69. --disable-wtmpx \
  70. --disable-loginfunc \
  71. $(if $(CONFIG_DROPBEAR_PUTUTLINE),,--disable-pututline) \
  72. --disable-pututxline \
  73. $(if $(CONFIG_DROPBEAR_ZLIB),,--disable-zlib) \
  74. --enable-bundled-libtom
  75. TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -flto
  76. TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver
  77. define Build/Configure
  78. : > $(PKG_BUILD_DIR)/localoptions.h
  79. $(Build/Configure/Default)
  80. echo '#define DEFAULT_PATH "$(TARGET_INIT_PATH)"' >> \
  81. $(PKG_BUILD_DIR)/localoptions.h
  82. echo '#define DROPBEAR_CURVE25519 $(if $(CONFIG_DROPBEAR_CURVE25519),1,0)' >> \
  83. $(PKG_BUILD_DIR)/localoptions.h
  84. for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH; do \
  85. echo "#define $$$$OPTION $(if $(CONFIG_DROPBEAR_ECC),1,0)" >> \
  86. $(PKG_BUILD_DIR)/localoptions.h; \
  87. done
  88. # remove protocol idented software version number
  89. $(ESED) 's,^(#define LOCAL_IDENT) .*$$$$,\1 "SSH-2.0-dropbear",g' \
  90. $(PKG_BUILD_DIR)/sysoptions.h
  91. # disable legacy/unsafe methods and unused functionality
  92. for OPTION in INETD_MODE DROPBEAR_CLI_NETCAT \
  93. DROPBEAR_3DES DROPBEAR_DSS DROPBEAR_ENABLE_CBC_MODE \
  94. DROPBEAR_SHA1_96_HMAC DROPBEAR_USE_PASSWORD_ENV; do \
  95. echo "#define $$$$OPTION 0" >> \
  96. $(PKG_BUILD_DIR)/localoptions.h; \
  97. done
  98. # enable nistp384 and nistp521 only if full ECC support was requested
  99. for OPTION in DROPBEAR_ECC_384 DROPBEAR_ECC_521; do \
  100. $(ESED) 's,^(#define '$$$$OPTION') .*$$$$,\1 $(if $(CONFIG_DROPBEAR_ECC_FULL),1,0),g' \
  101. $(PKG_BUILD_DIR)/sysoptions.h; \
  102. done
  103. # Enforce rebuild of svr-chansession.c
  104. rm -f $(PKG_BUILD_DIR)/svr-chansession.o
  105. endef
  106. define Build/Compile
  107. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  108. $(TARGET_CONFIGURE_OPTS) \
  109. PROGRAMS="dropbear $(if $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey scp" \
  110. MULTI=1 SCPPROGRESS=1
  111. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  112. $(TARGET_CONFIGURE_OPTS) \
  113. PROGRAMS="dropbearconvert"
  114. endef
  115. define Package/dropbear/install
  116. $(INSTALL_DIR) $(1)/usr/sbin
  117. $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
  118. $(INSTALL_DIR) $(1)/usr/bin
  119. $(if $(CONFIG_DROPBEAR_DBCLIENT),$(LN) ../sbin/dropbear $(1)/usr/bin/dbclient,)
  120. $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
  121. $(INSTALL_DIR) $(1)/etc/config
  122. $(INSTALL_CONF) ./files/dropbear.config $(1)/etc/config/dropbear
  123. $(INSTALL_DIR) $(1)/etc/init.d
  124. $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
  125. $(INSTALL_DIR) $(1)/usr/lib/opkg/info
  126. $(INSTALL_DIR) $(1)/etc/dropbear
  127. $(if $(CONFIG_DROPBEAR_ECC),touch $(1)/etc/dropbear/dropbear_ecdsa_host_key)
  128. touch $(1)/etc/dropbear/dropbear_rsa_host_key
  129. endef
  130. define Package/dropbearconvert/install
  131. $(INSTALL_DIR) $(1)/usr/bin
  132. $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
  133. endef
  134. $(eval $(call BuildPackage,dropbear))
  135. $(eval $(call BuildPackage,dropbearconvert))