#!/bin/bash source sources/include.sh || exit 1 # Build a wrapper that records each command line the build runs out of the # host's $PATH, so we know exactly what commands the build uses. # (Note: this misses things called via absolute paths, such as the #!/bin/bash # at the start of shell scripts.) echo "=== Setting up command recording wrapper" test -f "$WRAPDIR/wrappy" && global PATH := $OLDPATH test -f "$HOSTTOOLS/toybox" && global PATH := $[hosttools_path] env NO_CLEANUP= blank_tempdir $WRAPDIR # Populate a directory of symlinks with every command in the $PATH. echo 'Linking $PATH to '$WRAPDIR path_search $PATH "*" 'ln -s wrappy "$WRAPDIR/$FILE"' !2 >/dev/null | dotprogress # Build the wrapper $CC -Os "$SOURCES/toys/wrappy.c" -o "$WRAPDIR/wrappy" || dienow (CommandList children: [ (AndOr children:[(C {(source)} {(sources/include.sh)})(C {(exit)} {(1)})] op_id:Op_DPipe) (C {(echo)} {(DQ ("=== Setting up command recording wrapper"))}) (AndOr children: [ (C {(Lit_Other "[")} {(-f)} {(DQ ($ VSub_Name "$WRAPDIR") (/wrappy))} {(Lit_Other "]")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PATH) op: Equal rhs: {(DQ ($ VSub_Name "$OLDPATH"))} spids: [49] ) ] spids: [49] ) ] op_id: Op_DAmp ) (AndOr children: [ (C {(Lit_Other "[")} {(-f)} {(DQ ($ VSub_Name "$HOSTTOOLS") (/toybox))} {(Lit_Other "]")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PATH) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(hosttools_path)})]) left_token: spids: [69 71] ) ) } spids: [67] ) ] spids: [67] ) ] op_id: Op_DAmp ) (SimpleCommand words: [{(blank_tempdir)} {(DQ ($ VSub_Name "$WRAPDIR"))}] more_env: [(env_pair name:NO_CLEANUP val:{(SQ )} spids:[74])] ) (C {(echo)} {(SQ <"Linking $PATH to ">) ($ VSub_Name "$WRAPDIR")}) (Pipeline children: [ (SimpleCommand words: [ {(path_search)} {(DQ ($ VSub_Name "$PATH"))} {(DQ ("*"))} {(SQ <"ln -s wrappy \"$WRAPDIR/$FILE\"">)} ] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[108])] ) (C {(dotprogress)}) ] negated: False ) (AndOr children: [ (C {($ VSub_Name "$CC")} {(-Os)} {(DQ ($ VSub_Name "$SOURCES") (/toys/wrappy.c))} {(-o)} {(DQ ($ VSub_Name "$WRAPDIR") (/wrappy))} ) (C {(dienow)}) ] op_id: Op_DPipe ) ] )