The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Test --with-relative-libdir in CI

+129 -7
+10 -4
.github/workflows/build-msvc.yml
··· 36 36 let compilers = ['cl', 'clang-cl']; 37 37 // # Also test i686 MSVC 38 38 let include = [ 39 - {cc: 'cl', arch: 'i686'}]; 39 + {cc: 'cl', arch: 'i686', libdir: 'relative'}]; 40 + let libdir = ['absolute']; 40 41 // # If this is a pull request, see if the PR has the 41 42 // # 'CI: Full matrix' label. This is done using an API request, 42 43 // # rather than from context.payload.pull_request.labels, since we ··· 52 53 // # Test Cygwin as well 53 54 compilers.push('gcc'); 54 55 // # Test bytecode-only Cygwin 55 - include.push({cc: 'gcc', arch: 'x86_64', config_arg: '--disable-native-toplevel --disable-native-compiler'}); 56 + include.push({cc: 'gcc', arch: 'x86_64', libdir: 'absolute', config_arg: '--disable-native-toplevel --disable-native-compiler'}); 57 + // # Test i686 MSVC absolute 58 + include.push({cc: 'cl', arch: 'i686', libdir: 'absolute'}); 59 + // # Expand the main matrix to include relative testing 60 + libdir.push('relative'); 56 61 } 57 62 } 58 - return {config_arg: [''], arch: ['x86_64'], cc: compilers, include: include}; 63 + return {config_arg: [''], arch: ['x86_64'], cc: compilers, libdir: libdir, include: include}; 59 64 - name: Determine if the testsuite should be skipped 60 65 id: skip 61 66 uses: actions/github-script@v7 ··· 79 84 80 85 timeout-minutes: ${{ matrix.cc == 'gcc' && 90 || 60 }} 81 86 82 - name: ${{ matrix.cc == 'cl' && 'MSVC' || matrix.cc == 'gcc' && 'Cygwin' || 'clang-cl' }} ${{ matrix.arch }} ${{ matrix.config_arg != '' && format('({0})', matrix.config_arg) || '' }} 87 + name: ${{ matrix.cc == 'cl' && 'MSVC' || matrix.cc == 'gcc' && 'Cygwin' || 'clang-cl' }} ${{ matrix.arch }} ${{ matrix.libdir }} ${{ matrix.config_arg != '' && format('({0})', matrix.config_arg) || '' }} 83 88 84 89 strategy: 85 90 matrix: ${{ fromJSON(needs.config.outputs.matrix) }} ··· 141 146 ${{ matrix.cc != 'gcc' && format('CC={0}', matrix.cc) || '' }} 142 147 --enable-ocamltest 143 148 ${{ endsWith(matrix.arch, '64') && '--enable-native-toplevel' || '--disable-native-toplevel' }} 149 + ${{ matrix.libdir == 'relative' && '--with-relative-libdir' || '--without-relative-libdir' }} 144 150 ${{ matrix.config_arg }} 145 151 run: | 146 152 eval $(tools/msvs-promote-path)
+29 -2
.github/workflows/build.yml
··· 59 59 '${{ github.event.repository.full_name }}' 60 60 - name: Configure tree 61 61 run: | 62 - MAKE_ARG=-j CONFIG_ARG='--enable-flambda --enable-cmm-invariants --enable-codegen-invariants --enable-dependency-generation --enable-native-toplevel' OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh configure 62 + MAKE_ARG=-j CONFIG_ARG='--enable-flambda --enable-cmm-invariants --enable-codegen-invariants --enable-dependency-generation --enable-native-toplevel --with-relative-libdir' OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh configure 63 63 - name: Build 64 64 run: | 65 65 MAKE_ARG=-j bash -xe tools/ci/actions/runner.sh build ··· 139 139 if: matrix.id == 'normal' 140 140 run: | 141 141 MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh test-in-prefix 142 + - name: Test in prefix (alternate configuration) 143 + if: matrix.id == 'normal' && needs.config.outputs.full-matrix == 'true' 144 + run: | 145 + MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh re-test-in-prefix 142 146 - name: Build the manual 143 147 if: matrix.id == 'normal' && needs.build.outputs.manual_changed == 'true' 144 148 run: | ··· 152 156 config: 153 157 runs-on: ubuntu-latest 154 158 outputs: 159 + full-matrix: ${{ steps.full.outputs.result }} 155 160 jobs: ${{ steps.jobs.outputs.result }} 156 161 skip-testsuite: ${{ steps.skip.outputs.result }} 157 162 steps: 163 + - name: Record if the build matrix is expanded 164 + id: full 165 + uses: actions/github-script@v7 166 + with: 167 + script: | 168 + let full_matrix = false; 169 + if (context.payload.pull_request) { 170 + const { data: labels } = 171 + await github.rest.issues.listLabelsOnIssue({...context.repo, issue_number: context.payload.pull_request.number}); 172 + full_matrix = labels.some(label => label.name === 'CI: Full matrix'); 173 + } 174 + console.log('Full matrix: ' + full_matrix); 175 + return full_matrix; 158 176 - name: Compute matrix for the "others" job 159 177 id: jobs 160 178 uses: actions/github-script@v7 ··· 169 187 {name: 'macos-x86_64', os: 'macos-15-intel', 170 188 'test-in-prefix': true}, 171 189 {name: 'macos-arm64', os: 'macos-latest', 190 + config_arg: '--with-relative-libdir', 172 191 'test-in-prefix': true}]; 173 192 // # If this is a pull request, see if the PR has the 174 193 // # 'CI: Full matrix' label. This is done using an API request, ··· 258 277 if: ${{ matrix.test-in-prefix }} 259 278 run: | 260 279 MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh test-in-prefix 280 + - name: Test in prefix (alternate configuration) 281 + if: ${{ matrix.test-in-prefix && needs.config.outputs.full-matrix == 'true' }} 282 + run: | 283 + MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh re-test-in-prefix 261 284 262 285 i386: 263 286 runs-on: ubuntu-latest ··· 290 313 su ocaml -c "bash -xe tools/ci/actions/runner.sh install" 291 314 - name: Test in prefix 292 315 run: | 293 - su ocaml -c "bash -xe tools/ci/actions/runner.sh test-in-prefix" 316 + MAKE_ARG=-j su ocaml -c "bash -xe tools/ci/actions/runner.sh test-in-prefix" 317 + - name: Test in prefix (alternate configuration) 318 + if: ${{ needs.config.outputs.full-matrix == 'true' }} 319 + run: | 320 + MAKE_ARG=-j su ocaml -c "bash -xe tools/ci/actions/runner.sh re-test-in-prefix"
+3 -1
Makefile
··· 483 483 utils/config_main.ml: utils/config.generated.ml utils/config.common.ml 484 484 $(V_GEN)cat $^ > $@ 485 485 486 + ADDITIONAL_CONFIGURE_ARGS ?= 486 487 .PHONY: reconfigure 487 488 reconfigure: 488 - ac_read_git_config=true ./configure $(CONFIGURE_ARGS) 489 + ac_read_git_config=true ./configure $(CONFIGURE_ARGS) \ 490 + $(ADDITIONAL_CONFIGURE_ARGS) 489 491 490 492 utils/domainstate.ml: utils/domainstate.ml.c runtime/caml/domain_state.tbl 491 493 $(V_GEN)$(CPP) -I runtime/caml $< > $@
+1
appveyor.yml
··· 41 41 matrix: 42 42 - PORT: mingw64 43 43 BOOTSTRAP_FLEXDLL: true 44 + RELOCATABLE: true 44 45 # OCaml 5.0 does not yet support MSVC 45 46 # - PORT: msvc64 46 47 # BOOTSTRAP_FLEXDLL: false
+83
tools/ci/actions/runner.sh
··· 128 128 $MAKE install 129 129 } 130 130 131 + target_libdir_is_relative='^ *TARGET_LIBDIR_IS_RELATIVE *= *false' 132 + 131 133 Test-In-Prefix () { 134 + { set +x 135 + echo 'Checking that compilers invoked with alternate runtimes use their' 136 + echo "configured location, not the alternate runtime's" 137 + expected1="$(realpath "$PREFIX/lib/ocaml")" 138 + } 2>/dev/null 139 + if [[ ! -d "$PREFIX.new" ]]; then 140 + # In Re-Test-In-Prefix, $PREFIX is the original compiler built by the 141 + # workflow and then $PREFIX.new is the "alternate configuration". The first 142 + # time round, we clone whichever compiler has just been built for this test. 143 + cp -a "$PREFIX" "$PREFIX.new" 144 + remove="$PREFIX.new" 145 + if grep -q "$target_libdir_is_relative" Makefile.build_config; then 146 + # Compiler configured absolutely - both should return the same answer 147 + expected2="$expected1" 148 + else 149 + # Compiler configured relatively 150 + expected2="$(realpath "$PREFIX").new/lib/ocaml" 151 + fi 152 + else 153 + # The alternate configuration path should be returned, regardless of whether 154 + # the runtime invoking it is an absolute or a relative one from another 155 + # location. 156 + expected2="$(realpath "$PREFIX").new/lib/ocaml-lib" 157 + remove='' 158 + fi 159 + { set +x 160 + lib1="$($PREFIX.new/bin/ocamlrun $PREFIX/bin/ocamlc.byte -where)" 161 + lib2="$($PREFIX/bin/ocamlrun $PREFIX.new/bin/ocamlc.byte -where)" 162 + echo "$PREFIX/bin/ocamlc.byte OSLD: $($PREFIX/bin/ocamlrun \ 163 + $PREFIX/bin/ocamlobjinfo.byte $PREFIX/bin/ocamlc.byte \ 164 + | sed -ne 's/^caml_standard_library_default: //p')" 165 + echo -n "$PREFIX.new/bin/ocamlrun standard_library_default: " 166 + $PREFIX.new/bin/ocamlrun -config | sed -ne 's/standard_library_default: //p' 167 + echo "$PREFIX.new/bin/ocamlrun $PREFIX/bin/ocamlc.byte -where: $lib1" 168 + if [[ $lib1 != $expected1 ]]; then 169 + echo -e ' \e[31mEXPECTED\e[0m:' "$expected1" 170 + fi 171 + echo 172 + echo "$PREFIX.new/bin/ocamlc.byte OSLD: $($PREFIX.new/bin/ocamlrun \ 173 + $PREFIX.new/bin/ocamlobjinfo.byte $PREFIX.new/bin/ocamlc.byte \ 174 + | sed -ne 's/^caml_standard_library_default: //p')" 175 + echo -n "$PREFIX/bin/ocamlrun standard_library_default: " 176 + $PREFIX/bin/ocamlrun -config | sed -ne 's/standard_library_default: //p' 177 + echo "$PREFIX/bin/ocamlrun $PREFIX.new/bin/ocamlc.byte -where: $lib2" 178 + if [[ $lib2 != $expected2 ]]; then 179 + echo -e ' \e[31mEXPECTED\e[0m:' "$expected2" 180 + fi 181 + [[ $lib1 = $expected1 && $lib2 = $expected2 ]] && echo 'Correct.' || exit 1 182 + } 2>/dev/null 183 + [[ -z $remove ]] || rm -rf "$remove" 132 184 $MAKE -C testsuite/in_prefix -f Makefile.test test-in-prefix 185 + } 186 + 187 + Re-Test-In-Prefix () { 188 + mkdir -p bak 189 + mv Makefile.config Makefile.build_config config.status bak 190 + git clean -dfX &>/dev/null 191 + mv bak/Makefile.config bak/Makefile.build_config bak/config.status . 192 + rmdir bak 193 + # The libdir is configured to be $PREFIX.new/lib/ocaml-lib in order to 194 + # "poison" the cross-runtime test (otherwise if $PREFIX/bin/ocamlc.byte is 195 + # missing OSLD, then $PREFIX.new/bin/ocamlrun would still supply the correct 196 + # ../lib/ocaml. This way, it supplies ../lib/ocaml-lib and the test correctly 197 + # fails) 198 + if grep -q "$target_libdir_is_relative" Makefile.build_config; then 199 + # Compiler configured absolutely - reconfigure relatively 200 + echo '::group::Re-building the compiler with a relative libdir' 201 + $MAKE COMPUTE_DEPS=false reconfigure \ 202 + 'ADDITIONAL_CONFIGURE_ARGS=--with-relative-libdir=../lib/ocaml-lib \ 203 + --prefix='"$PREFIX"'.new' 204 + else 205 + # Compiler configured relatively - reconfigure absolutely 206 + echo '::group::Re-building the compiler with an absolute libdir' 207 + $MAKE COMPUTE_DEPS=false reconfigure \ 208 + 'ADDITIONAL_CONFIGURE_ARGS=--without-relative-libdir \ 209 + --prefix='"$PREFIX"'.new --libdir='"$PREFIX"'.new/lib/ocaml-lib' 210 + fi 211 + $MAKE 212 + $MAKE install 213 + echo '::endgroup::' 214 + Test-In-Prefix 133 215 } 134 216 135 217 Checks () { ··· 223 305 api-docs) API_Docs;; 224 306 install) Install;; 225 307 test-in-prefix) Test-In-Prefix;; 308 + re-test-in-prefix) Re-Test-In-Prefix;; 226 309 manual) BuildManual;; 227 310 other-checks) Checks;; 228 311 basic-compiler) BasicCompiler;;
+3
tools/ci/appveyor/appveyor_build.sh
··· 76 76 args+=('--host=x86_64-pc-windows' '--enable-dependency-generation' \ 77 77 '--enable-native-toplevel');; 78 78 esac 79 + if [[ $RELOCATABLE = 'true' ]]; then 80 + args+=('--with-relative-libdir') 81 + fi 79 82 80 83 # Remove old configure cache if the configure script or the OS 81 84 # have changed