ipsec-tools.mk 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #############################################################
  2. #
  3. # ipsec-tools
  4. #
  5. #############################################################
  6. IPSEC_TOOLS_VERSION:=0.7.2
  7. IPSEC_TOOLS_SOURCE:=ipsec-tools-$(IPSEC_TOOLS_VERSION).tar.bz2
  8. IPSEC_TOOLS_CAT:=$(BZCAT)
  9. IPSEC_TOOLS_DIR:=$(BUILD_DIR)/ipsec-tools-$(IPSEC_TOOLS_VERSION)
  10. IPSEC_TOOLS_BINARY_SETKEY:=src/setkey/setkey
  11. IPSEC_TOOLS_BINARY_RACOON:=src/racoon/racoon
  12. IPSEC_TOOLS_BINARY_RACOONCTL:=src/racoon/racoonctl
  13. IPSEC_TOOLS_TARGET_BINARY_SETKEY:=usr/sbin/setkey
  14. IPSEC_TOOLS_TARGET_BINARY_RACOON:=usr/sbin/racoon
  15. IPSEC_TOOLS_TARGET_BINARY_RACOONCTL:=usr/sbin/racoonctl
  16. IPSEC_TOOLS_SITE=http://ftp.sunet.se/pub/NetBSD/misc/ipsec-tools/0.7/
  17. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_ADMINPORT), y)
  18. IPSEC_TOOLS_CONFIG_FLAGS+= --enable-adminport
  19. else
  20. IPSEC_TOOLS_CONFIG_FLAGS+= --disable-adminport
  21. endif
  22. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_NATT), y)
  23. IPSEC_TOOLS_CONFIG_FLAGS+= --enable-natt
  24. else
  25. IPSEC_TOOLS_CONFIG_FLAGS+= --disable-natt
  26. endif
  27. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_FRAG), y)
  28. IPSEC_TOOLS_CONFIG_FLAGS+= --enable-frag
  29. else
  30. IPSEC_TOOLS_CONFIG_FLAGS+= --disable-frag
  31. endif
  32. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_STATS), y)
  33. IPSEC_TOOLS_CONFIG_FLAGS+= --enable-stats
  34. else
  35. IPSEC_TOOLS_CONFIG_FLAGS+= --disable-stats
  36. endif
  37. ifeq ($(BR2_INET_IPV6),y)
  38. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_IPV6), y)
  39. IPSEC_TOOLS_CONFIG_FLAGS+= --enable-ipv6
  40. else
  41. IPSEC_TOOLS_CONFIG_FLAGS+= $(DISABLE_IPV6)
  42. endif
  43. else # ignore user's choice if it doesn't
  44. IPSEC_TOOLS_CONFIG_FLAGS+= $(DISABLE_IPV6)
  45. endif
  46. ifneq ($(BR2_PACKAGE_IPSEC_TOOLS_READLINE), y)
  47. IPSEC_TOOLS_CONFIG_FLAGS+= --without-readline
  48. endif
  49. ifeq ($(BR2_PACKAGE_IPSEC_SECCTX_DISABLE),y)
  50. IPSEC_TOOLS_CONFIG_FLAGS+= --enable-security-context=no
  51. endif
  52. ifeq ($(BR2_PACKAGE_IPSEC_SECCTX_ENABLE),y)
  53. IPSEC_TOOLS_CONFIG_FLAGS+= --enable-security-context=yes
  54. endif
  55. ifeq ($(BR2_PACKAGE_IPSEC_SECCTX_KERNEL),y)
  56. IPSEC_TOOLS_CONFIG_FLAGS+= --enable-security-context=kernel
  57. endif
  58. $(DL_DIR)/$(IPSEC_TOOLS_SOURCE):
  59. $(call DOWNLOAD,$(IPSEC_TOOLS_SITE),$(IPSEC_TOOLS_SOURCE))
  60. $(IPSEC_TOOLS_DIR)/.patched: $(DL_DIR)/$(IPSEC_TOOLS_SOURCE)
  61. $(IPSEC_TOOLS_CAT) $(DL_DIR)/$(IPSEC_TOOLS_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
  62. toolchain/patch-kernel.sh $(IPSEC_TOOLS_DIR) package/ipsec-tools ipsec-tools-$(IPSEC_TOOLS_VERSION)\*.patch
  63. $(CONFIG_UPDATE) $(IPSEC_TOOLS_DIR)
  64. touch $@
  65. $(IPSEC_TOOLS_DIR)/.configured: $(IPSEC_TOOLS_DIR)/.patched
  66. ( cd $(IPSEC_TOOLS_DIR); rm -rf config.cache; \
  67. $(TARGET_CONFIGURE_OPTS) \
  68. $(TARGET_CONFIGURE_ARGS) \
  69. ./configure $(QUIET) \
  70. --target=$(GNU_TARGET_NAME) \
  71. --host=$(GNU_TARGET_NAME) \
  72. --build=$(GNU_HOST_NAME) \
  73. --prefix=/usr \
  74. --sysconfdir=/etc \
  75. --disable-hybrid \
  76. --without-libpam \
  77. --disable-gssapi \
  78. --with-kernel-headers=$(STAGING_DIR)/usr/include \
  79. $(IPSEC_TOOLS_CONFIG_FLAGS) \
  80. )
  81. # simpler than patching that cruft..
  82. (echo '#undef bzero'; \
  83. echo '#define bzero(a, b) memset((a), 0, (b))'; \
  84. echo '#undef bcopy'; \
  85. echo '#define bcopy(src, dest, len) memmove(dest, src, len)'; \
  86. echo '#undef index'; \
  87. echo '#define index(a, b) strchr(a, b)'; \
  88. ) >> $(IPSEC_TOOLS_DIR)/config.h
  89. touch $@
  90. $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_SETKEY) \
  91. $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_RACOON) \
  92. $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_RACOONCTL): \
  93. $(IPSEC_TOOLS_DIR)/.configured
  94. $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(IPSEC_TOOLS_DIR)
  95. $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_SETKEY) \
  96. $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOON) \
  97. $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOONCTL): \
  98. $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_SETKEY) \
  99. $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_RACOON) \
  100. $(IPSEC_TOOLS_DIR)/$(IPSEC_TOOLS_BINARY_RACOONCTL)
  101. $(MAKE) -C $(IPSEC_TOOLS_DIR) DESTDIR=$(TARGET_DIR) install
  102. $(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(REMOVE_SECTION_COMMENT) \
  103. $(REMOVE_SECTION_NOTE) \
  104. $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_SETKEY) \
  105. $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOON) \
  106. $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOONCTL)
  107. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_LIBS), y)
  108. install -D $(addprefix $(IPSEC_TOOLS_DIR)/src/, \
  109. libipsec/.libs/libipsec.a libipsec/.libs/libipsec.la \
  110. racoon/.libs/libracoon.a racoon/.libs/libracoon.la) \
  111. $(STAGING_DIR)/lib
  112. endif
  113. ifneq ($(BR2_PACKAGE_IPSEC_TOOLS_ADMINPORT), y)
  114. rm -f $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOONCTL)
  115. endif
  116. IPSEC_TOOLS_PROGS= $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_SETKEY) \
  117. $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOON)
  118. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_ADMINPORT), y)
  119. IPSEC_TOOLS_PROGS+= $(TARGET_DIR)/$(IPSEC_TOOLS_TARGET_BINARY_RACOONCTL)
  120. endif
  121. ipsec-tools: openssl flex host-flex $(IPSEC_TOOLS_PROGS)
  122. ipsec-tools-source: $(DL_DIR)/$(IPSEC_TOOLS_SOURCE)
  123. ipsec-tools-uninstall:
  124. ipsec-tools-clean:
  125. -$(MAKE) -C $(IPSEC_TOOLS_DIR) DESTDIR=$(TARGET_DIR) uninstall
  126. -$(MAKE) -C $(IPSEC_TOOLS_DIR) clean
  127. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS_LIBS),y)
  128. rm -f $(addprefix $(STAGING_DIR)/lib/, \
  129. libipsec.a libipsec.la libracoon.a libracoon.la)
  130. endif
  131. rm -f $(IPSEC_TOOLS_DIR)/.configured
  132. ipsec-tools-dirclean:
  133. rm -rf $(IPSEC_TOOLS_DIR)
  134. ifeq ($(BR2_PACKAGE_IPSEC_TOOLS), y)
  135. TARGETS+=ipsec-tools
  136. endif