Skip to content

Commit 0c7b609

Browse files
authored
Pass directory path from call-site (#59858)
1 parent 03e90a5 commit 0c7b609

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

eng/common/native/init-compiler.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@
33
# This file detects the C/C++ compiler and exports it to the CC/CXX environment variables
44
#
55

6-
if [[ "$#" -lt 2 ]]; then
6+
if [[ "$#" -lt 3 ]]; then
77
echo "Usage..."
8-
echo "init-compiler.sh <Architecture> <compiler> <compiler major version> <compiler minor version>"
8+
echo "init-compiler.sh <script directory> <Architecture> <compiler> <compiler major version> <compiler minor version>"
9+
echo "Specify the script directory."
910
echo "Specify the target architecture."
1011
echo "Specify the name of compiler (clang or gcc)."
1112
echo "Specify the major version of compiler."
1213
echo "Specify the minor version of compiler."
1314
exit 1
1415
fi
1516

16-
. "$( cd -P "$( dirname "$0" )" && pwd )"/../pipeline-logging-functions.sh
17-
18-
build_arch="$1"
19-
compiler="$2"
17+
nativescriptroot="$1"
18+
build_arch="$2"
19+
compiler="$3"
2020
cxxCompiler="$compiler++"
21-
majorVersion="$3"
22-
minorVersion="$4"
21+
majorVersion="$4"
22+
minorVersion="$5"
23+
24+
. "$nativescriptroot"/../pipeline-logging-functions.sh
2325

2426
# clear the existing CC and CXX from environment
2527
CC=

eng/native/gen-buildsys.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ majorVersion="$5"
2727
minorVersion="$6"
2828

2929
if [[ "$compiler" != "default" ]]; then
30-
source "$scriptroot/../common/native/init-compiler.sh" "$build_arch" "$compiler" "$majorVersion" "$minorVersion"
30+
nativescriptroot="$( cd -P "$scriptroot/../common/native" && pwd )"
31+
source "$nativescriptroot/init-compiler.sh" "$nativescriptroot" "$build_arch" "$compiler" "$majorVersion" "$minorVersion"
3132

3233
CCC_CC="$CC"
3334
CCC_CXX="$CXX"

src/mono/mono.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@
471471
<PropertyGroup>
472472
<EMSDK_PATH>$([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)'))</EMSDK_PATH>
473473
<_MonoCMakeConfigureCommand>cmake @(_MonoCMakeArgs, ' ') $(MonoCMakeExtraArgs) &quot;$(MonoProjectRoot.TrimEnd('\/'))&quot;</_MonoCMakeConfigureCommand>
474-
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(OS)' != 'Windows_NT'">bash -c 'source $(RepositoryEngineeringCommonDir)native/init-compiler.sh $(_CompilerTargetArch) $(MonoCCompiler) &amp;&amp; @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)'</_MonoCMakeConfigureCommand>
474+
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(OS)' != 'Windows_NT'">bash -c 'source $(RepositoryEngineeringCommonDir)native/init-compiler.sh &quot;$(RepositoryEngineeringCommonDir)native&quot; &quot;$(_CompilerTargetArch)&quot; &quot;$(MonoCCompiler)&quot; &amp;&amp; @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)'</_MonoCMakeConfigureCommand>
475475
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(OS)' == 'Windows_NT'">call &quot;$(RepositoryEngineeringDir)native\init-vs-env.cmd&quot; $(_CompilerTargetArch) &amp;&amp; cd /D &quot;$(MonoObjDir)&quot; &amp;&amp; @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)</_MonoCMakeConfigureCommand>
476476
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' == 'false'">$(_MonoCCOption) $(_MonoCXXOption) @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)</_MonoCMakeConfigureCommand>
477477
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&amp;1 &amp;&amp; emcmake $(_MonoCMakeConfigureCommand)'</_MonoCMakeConfigureCommand>

0 commit comments

Comments
 (0)