mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-02-20 17:12:55 +00:00
scripts: fix tools override
The tools found by the new autostuff configure can contain arguments, for example: grep -E This needs separating the paths set for the Makfile from the paths set for the scripts. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
parent
b03575409e
commit
b86899a341
@ -10,6 +10,7 @@ Makefile
|
||||
docs/*ct-ng*.1
|
||||
docs/*ct-ng*.1.gz
|
||||
paths.mk
|
||||
paths.sh
|
||||
scripts/crosstool-NG.sh
|
||||
scripts/saveSample.sh
|
||||
scripts/showTuple.sh
|
||||
|
57
Makefile.in
57
Makefile.in
@ -151,8 +151,9 @@ build-bin: $(PROG_NAME) \
|
||||
scripts/showTuple.sh
|
||||
@chmod 755 $^
|
||||
|
||||
build-lib: paths.mk \
|
||||
config/configure.in
|
||||
build-lib: config/configure.in \
|
||||
paths.mk \
|
||||
paths.sh
|
||||
|
||||
build-lib-kconfig:
|
||||
@$(MAKE) -C kconfig
|
||||
@ -189,24 +190,36 @@ $(PROG_NAME): ct-ng.in Makefile
|
||||
$(call sed_it)
|
||||
|
||||
# We create a script fragment that is parseable from inside a Makefile,
|
||||
# but also from inside a shell script, hence the reason why we don't
|
||||
# use := to set variables, although that will incur a (very small)
|
||||
# penalty from the Makefile that includes it (due to re-evaluation at
|
||||
# each call).
|
||||
# and one from inside a shell script
|
||||
paths.mk: FORCE
|
||||
@echo " GEN '$@'"
|
||||
@(echo "export install=$(install)"; \
|
||||
echo "export bash=$(bash)"; \
|
||||
echo "export grep=$(grep)"; \
|
||||
echo "export make=$(make)"; \
|
||||
echo "export sed=$(sed)"; \
|
||||
echo "export libtool=$(libtool)"; \
|
||||
echo "export libtoolize=$(libtoolize)"; \
|
||||
echo "export objcopy=$(objcopy)"; \
|
||||
echo "export objdump=$(objdump)"; \
|
||||
echo "export readelf=$(readelf)"; \
|
||||
echo "export patch=$(patch)"; \
|
||||
) >paths.mk
|
||||
@(echo 'export install=$(install)'; \
|
||||
echo 'export bash=$(bash)'; \
|
||||
echo 'export grep=$(grep)'; \
|
||||
echo 'export make=$(make)'; \
|
||||
echo 'export sed=$(sed)'; \
|
||||
echo 'export libtool=$(libtool)'; \
|
||||
echo 'export libtoolize=$(libtoolize)'; \
|
||||
echo 'export objcopy=$(objcopy)'; \
|
||||
echo 'export objdump=$(objdump)'; \
|
||||
echo 'export readelf=$(readelf)'; \
|
||||
echo 'export patch=$(patch)'; \
|
||||
) >$@
|
||||
|
||||
paths.sh: FORCE
|
||||
@echo " GEN '$@'"
|
||||
@(echo 'export install="$(install)"'; \
|
||||
echo 'export bash="$(bash)"'; \
|
||||
echo 'export grep="$(grep)"'; \
|
||||
echo 'export make="$(make)"'; \
|
||||
echo 'export sed="$(sed)"'; \
|
||||
echo 'export libtool="$(libtool)"'; \
|
||||
echo 'export libtoolize="$(libtoolize)"'; \
|
||||
echo 'export objcopy="$(objcopy)"'; \
|
||||
echo 'export objdump="$(objdump)"'; \
|
||||
echo 'export readelf="$(readelf)"'; \
|
||||
echo 'export patch="$(patch)"'; \
|
||||
) >$@
|
||||
|
||||
config/configure.in: FORCE
|
||||
@echo " GEN '$@'"
|
||||
@ -239,8 +252,8 @@ clean-bin:
|
||||
@rm -f scripts/showTuple.sh
|
||||
|
||||
clean-lib:
|
||||
@echo " RM 'paths.mk'"
|
||||
@rm -f paths.mk
|
||||
@echo " RM 'paths'"
|
||||
@rm -f paths.mk paths.sh
|
||||
@echo " RM 'config/configure.in'"
|
||||
@rm -f config/configure.in
|
||||
|
||||
@ -304,8 +317,8 @@ install-lib-scripts: install-lib-scripts-copy
|
||||
install-lib-main: $(DESTDIR)$(libdir) $(patsubst %,install-lib-%,$(LIB_SUB_DIR))
|
||||
@echo " INST 'steps.mk'"
|
||||
@$(install) -m 644 steps.mk "$(DESTDIR)$(libdir)/steps.mk"
|
||||
@echo " INST 'paths.mk'"
|
||||
@$(install) -m 644 paths.mk "$(DESTDIR)$(libdir)/paths.mk"
|
||||
@echo " INST 'paths'"
|
||||
@$(install) -m 644 paths.mk paths.sh "$(DESTDIR)$(libdir)"
|
||||
|
||||
# Samples need a little love:
|
||||
# - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
|
||||
|
@ -7,10 +7,10 @@ myname="$0"
|
||||
# Parse the tools' paths configuration
|
||||
# It is expected that this script is only to be run from the
|
||||
# source directory of crosstool-NG, so it is trivial to find
|
||||
# paths.mk (we can't use ". paths.mk", as POSIX states that
|
||||
# paths.sh (we can't use ". paths.sh", as POSIX states that
|
||||
# $PATH should be searched for, and $PATH most probably doe
|
||||
# not include "."), hence the "./".
|
||||
. "./paths.mk"
|
||||
. "./paths.sh"
|
||||
|
||||
doHelp() {
|
||||
cat <<-EOF
|
||||
|
@ -78,11 +78,13 @@ CT_TestOrAbort "The CONFIG_SHELL '${CT_CONFIG_SHELL}' is not valid" -f "${CT_CON
|
||||
CT_TOOLS_OVERIDE_DIR="${CT_WORK_DIR}/tools"
|
||||
CT_DoLog DEBUG "Creating bin-override for tools in '${CT_TOOLS_OVERIDE_DIR}'"
|
||||
CT_DoExecLog DEBUG mkdir -p "${CT_TOOLS_OVERIDE_DIR}/bin"
|
||||
cat "${CT_LIB_DIR}/paths.mk" |while read trash line; do
|
||||
cat "${CT_LIB_DIR}/paths.sh" |while read trash line; do
|
||||
tool="${line%%=*}"
|
||||
path="${line#*=}"
|
||||
CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}'"
|
||||
printf "#${BANG}${CT_CONFIG_SHELL}\nexec '${path}' \"\${@}\"\n" >"${CT_TOOLS_OVERIDE_DIR}/bin/${tool}"
|
||||
# Note: we need to supress the " in the path because
|
||||
# there can be arguments in there (thanks autostuff...)
|
||||
printf "#${BANG}${CT_CONFIG_SHELL}\nexec ${path//\"/} \"\${@}\"\n" >"${CT_TOOLS_OVERIDE_DIR}/bin/${tool}"
|
||||
CT_DoExecLog ALL chmod 700 "${CT_TOOLS_OVERIDE_DIR}/bin/${tool}"
|
||||
done
|
||||
export PATH="${CT_TOOLS_OVERIDE_DIR}/bin:${PATH}"
|
||||
|
@ -7,10 +7,10 @@ myname="$0"
|
||||
# Parse the tools' paths configuration
|
||||
# It is expected that this script is only to be run from the
|
||||
# source directory of crosstool-NG, so it is trivial to find
|
||||
# paths.mk (we can't use ". paths.mk", as POSIX states that
|
||||
# paths.sh (we can't use ". paths.sh", as POSIX states that
|
||||
# $PATH should be searched for, and $PATH most probably doe
|
||||
# not include "."), hence the "./".
|
||||
. "./paths.mk"
|
||||
. "./paths.sh"
|
||||
|
||||
doUsage() {
|
||||
cat <<_EOF_
|
||||
|
@ -9,7 +9,7 @@
|
||||
# - info about who reported the sample
|
||||
|
||||
# Parse the tools' paths configuration
|
||||
. "${CT_LIB_DIR}/paths.mk"
|
||||
. "${CT_LIB_DIR}/paths.sh"
|
||||
|
||||
# We'll need the stdout later, save it
|
||||
exec 7>&1
|
||||
|
@ -5,7 +5,7 @@
|
||||
# the versions of the main tools
|
||||
|
||||
# Use tools discovered by ./configure
|
||||
. "${CT_LIB_DIR}/paths.mk"
|
||||
. "${CT_LIB_DIR}/paths.sh"
|
||||
|
||||
[ "$1" = "-v" ] && opt="$1" && shift
|
||||
[ "$1" = "-w" ] && opt="$1" && shift
|
||||
|
@ -4,7 +4,7 @@
|
||||
# - the .config file
|
||||
|
||||
# Parse the tools' paths configuration
|
||||
. "${CT_LIB_DIR}/paths.mk"
|
||||
. "${CT_LIB_DIR}/paths.sh"
|
||||
|
||||
# We'll need the stdout later, save it
|
||||
exec 7>&1
|
||||
|
Loading…
x
Reference in New Issue
Block a user