ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Apr 26 21:31:05 2008 +0000 (2008-04-26)
changeset 454 372b2f397baa
parent 372 f635b165bf18
child 543 1df70ed4510d
permissions -rw-r--r--
Configure tsocks with a simple heuristic.

Consider the proxy has to be in a 'local' network. It means it is directly
reachable by the local machine, even if the local machine has to hop through
one or more gates to reach the proxy (often the case in enterprise networks
where class A 10.0.0.0/8 is in fact sub-divided into smaller networks, each
one of them in a different location, eg. 10.1.0.0/16 in a place, while
10.2.0.0/16 would be on the other side of the world). Not being in the same
subnet does not mean the proxy is not available.

So we will build a mask with at most high bits set, which defines a network
that has both the local machine and the proxy. Because a machine may have
more than one interface, build a mask for each of them, removing 127.0.0.1
which is added automagically by tsocks, and removing duplicate masks.

If all of this does not work, then it means the local machine can NOT in fact
reach the proxy, which in turn means the user mis-configured something (most
probably a typo...).

/trunk/scripts/crosstool.sh | 61 52 9 0 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 9 deletions(-)
     1 #!@@CT_MAKE@@ -rf
     2 # Makefile for crosstool-NG.
     3 # Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
     4 
     5 # Don't print directory as we descend into them
     6 # Don't use built-in rules, we know what we're doing
     7 MAKEFLAGS += --no-print-directory --no-builtin-rules
     8 
     9 # Some distributions (eg. Ubuntu) thought it wise to point /bin/sh to
    10 # a truly POSIX-conforming shell, ash in this case. This is not so good
    11 # as we, smart (haha!) developers (as smart we ourselves think we are),
    12 # got used to bashisms, and are enclined to easiness... So force use of
    13 # bash. (Note: this is ugly, but ./configure checks for it).
    14 export SHELL=/bin/bash
    15 
    16 # This is where ct-ng is.
    17 # Don't bother to change it other than with a new ./configure!
    18 CT_NG:=@@CT_BINDIR@@/ct-ng
    19 
    20 export CT_TOP_DIR:=$(shell pwd)
    21 export CT_LIB_DIR:=@@CT_LIBDIR@@
    22 export CT_DOC_DIR:=@@CT_DOCDIR@@
    23 
    24 # This is crosstool-NG version string
    25 export CT_VERSION:=$(shell cat $(CT_LIB_DIR)/.version)
    26 
    27 export CT_STOP:=$(STOP)
    28 export CT_RESTART:=$(RESTART)
    29 
    30 .PHONY: $(PHONY)
    31 PHONY += all
    32 all: help
    33 
    34 HOST_CC := gcc -funsigned-char
    35 
    36 # Help system
    37 help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
    38 
    39 help-head::
    40 	@echo  'Available actions:'
    41 
    42 help-config::
    43 	@echo
    44 	@echo  'Configuration actions:'
    45 
    46 help-samples::
    47 	@echo
    48 	@echo  'Preconfigured toolchains:'
    49 
    50 help-build::
    51 	@echo
    52 	@echo  'Build actions (#: force number of // jobs):'
    53 
    54 help-clean::
    55 	@echo
    56 	@echo  'Clean actions:'
    57 
    58 help-distrib::
    59 	@echo
    60 	@echo  'Distribution actions:'
    61 
    62 help-env::
    63 	@echo
    64 	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
    65 
    66 help-tail::
    67 	@echo
    68 	@echo  'Execute "$(CT_NG) config" or "$(CT_NG) menuconfig" to configure crosstool-NG'
    69 	@echo  'Execute "$(CT_NG) build" to build your toolchain'
    70 	@echo  'Execute "$(CT_NG) version" to see the version'
    71 	@echo  'See "man 1 ct-ng" for some help as well'
    72 
    73 # End help system
    74 
    75 help-build::
    76 	@echo  '  build[.#]          - Build the toolchain'
    77 
    78 help-clean::
    79 	@echo  '  clean              - Remove generated files'
    80 	@echo  '  distclean          - Remove generated files, configuration and build directories'
    81 
    82 include $(CT_LIB_DIR)/kconfig/kconfig.mk
    83 include $(CT_LIB_DIR)/steps.mk
    84 include $(CT_LIB_DIR)/samples/samples.mk
    85 include $(CT_LIB_DIR)/tools/tools.mk
    86 
    87 help-distrib::
    88 	@echo  '  tarball            - Build a tarball of the configured toolchain'
    89 
    90 help-env::
    91 	@echo  '  STOP               - Stop the build just after this step'
    92 	@echo  '  RESTART            - Restart the build just before this step'
    93 
    94 .config:
    95 	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
    96 	@false
    97 
    98 # Actual build
    99 build: .config
   100 	@$(CT_LIB_DIR)/scripts/crosstool.sh
   101 
   102 build.%:
   103 	@$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
   104 
   105 PHONY += tarball
   106 #tarball:
   107 #	@$(CT_LIB_DIR)/scripts/tarball.sh
   108 tarball:
   109 	@echo 'Tarbal creation disabled for now... Sorry.'
   110 	@true
   111 
   112 PHONY += version
   113 version:
   114 	@echo 'This is crosstool-NG version $(CT_VERSION)'
   115 
   116 PHONY += clean
   117 clean::
   118 	@rm -f $(CT_TOP_DIR)/.config.*
   119 
   120 PHONY += distclean
   121 distclean:: clean
   122 	@rm -f $(CT_TOP_DIR)/.config* $(CT_TOP_DIR)/..config.tmp
   123 	@rm -f $(CT_TOP_DIR)/log.*
   124 	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
   125 	@rm -rf "$(CT_TOP_DIR)/targets"