@@ -75,6 +75,10 @@ export GPR2_BUILD=release
7575export VSS_BUILD_PROFILE=release
7676export PRETTIER_ADA_BUILD_MODE=prod
7777
78+ # Global switch for a workaround on macOS. Set to non-empty to activate the
79+ # workaround.
80+ USE_GNAT_ADC_BASENAME=" "
81+
7882function activate_venv() {
7983 [ -d " $VENV_PATH " ] || python -m venv " $VENV_PATH "
8084 case " $NODE_ARCH_PLATFORM " in
@@ -163,21 +167,21 @@ function build_langkit_raw() {
163167 # Adjust the scenario variable for libgpr2
164168 sed -i.bak -e ' s/GPR_BUILD/GPR_LIBRARY_TYPE/' ./langkit/libmanage.py
165169
166- case " $NODE_ARCH_PLATFORM " in
167- * darwin * )
168- # On macOS, the full path of gnat.adc is stored in ALI files with case
169- # normalization. Upon re-runs, gprbuild is unable to match the
170- # normalized path with a non-case-normalized real path. This causes
171- # unnecessary recompilations at every run.
172- #
173- # To avoid that, we use the -gnateb flag which tells GNAT to not use
174- # an absolute path for gnat.adc
175- gprbuild_flag= " --gargs=-cargs:ada -gnateb"
176- ;;
177- * )
178- gprbuild_flag= " --gargs= "
179- ;;
180- esac
170+ gprbuild_flag= " --gargs= "
171+ if [ -n " $USE_GNAT_ADC_BASENAME " ] ; then
172+ case " $NODE_ARCH_PLATFORM " in
173+ * darwin * )
174+ # On macOS, the full path of gnat.adc is stored in ALI files with case
175+ # normalization. Upon re-runs, gprbuild is unable to match the
176+ # normalized path with a non-case-normalized real path. This causes
177+ # unnecessary recompilations at every run.
178+ #
179+ # To avoid that, we use the -gnateb flag which tells GNAT to not use
180+ # an absolute path for gnat.adc
181+ gprbuild_flag= " --gargs=-cargs:ada -gnateb "
182+ ;;
183+ esac
184+ fi
181185
182186 # Install base langkit support Python library
183187 pip install .
@@ -274,18 +278,20 @@ function set_langkit_usage_env() {
274278function build_als() {
275279 set_langkit_usage_env
276280
277- case " $NODE_ARCH_PLATFORM " in
278- * darwin* )
279- # On macOS, the full path of gnat.adc is stored in ALI files with case
280- # normalization. Upon re-runs, gprbuild is unable to match the
281- # normalized path with a non-case-normalized real path. This causes
282- # unnecessary recompilations at every run.
283- #
284- # To avoid that, we use the -gnateb flag which tells GNAT to not use
285- # an absolute path for gnat.adc
286- gprbuild_flag=" -cargs:ada -gnateb"
287- ;;
288- esac
281+ if [ -n " $USE_GNAT_ADC_BASENAME " ]; then
282+ case " $NODE_ARCH_PLATFORM " in
283+ * darwin* )
284+ # On macOS, the full path of gnat.adc is stored in ALI files with case
285+ # normalization. Upon re-runs, gprbuild is unable to match the
286+ # normalized path with a non-case-normalized real path. This causes
287+ # unnecessary recompilations at every run.
288+ #
289+ # To avoid that, we use the -gnateb flag which tells GNAT to not use
290+ # an absolute path for gnat.adc
291+ gprbuild_flag=" -cargs:ada -gnateb"
292+ ;;
293+ esac
294+ fi
289295
290296 # We use 'alr exec' to benefit from Alire setting up GPR_PROJECT_PATH with
291297 # all the dependencies.
0 commit comments