pax_global_header 0000666 0000000 0000000 00000000064 15204417140 0014510 g ustar 00root root 0000000 0000000 52 comment=08f6a4a358954301cbf06dea8743ac87d7daca0f
camlp5-camlp5-buildscripts-08f6a4a/ 0000775 0000000 0000000 00000000000 15204417140 0017170 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/.github/ 0000775 0000000 0000000 00000000000 15204417140 0020530 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/.github/actions/ 0000775 0000000 0000000 00000000000 15204417140 0022170 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/.github/actions/ci-utils/ 0000775 0000000 0000000 00000000000 15204417140 0023721 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/.github/actions/ci-utils/action.yml 0000664 0000000 0000000 00000015315 15204417140 0025726 0 ustar 00root root 0000000 0000000 # Copied from geneweb (courtesy of @a2line)
name: 'CI Utilities'
description: 'Utilities for Camlp5 CI including timing, metrics collection and summaries'
inputs:
command:
description: 'Command to execute (collect-metrics or generate-summary)'
required: true
os:
description: 'Operating system'
required: false
ocaml-version:
description: 'OCaml version'
required: false
cache-hit:
description: 'Cache hit status'
required: false
default: 'false'
total-builds:
description: 'Total number of builds'
required: true
outputs:
metric:
description: 'Build metric in JSON format'
value: ${{ steps.collect.outputs.metric }}
runs:
using: "composite"
steps:
# Timer Start
- if: inputs.command == 'start-timer'
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: |
${{ runner.os == 'Windows' && '
$startTime = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
"start_time=$startTime" | Out-File -FilePath $env:GITHUB_ENV -Append
' || 'echo "start_time=$(date +%s)" >> $GITHUB_ENV' }}
# Metrics Collection
- if: inputs.command == 'collect-metrics'
id: collect
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: |
${{ runner.os == 'Windows' && '
$startTime = [int]$env:start_time
$endTime = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
$buildTime = $endTime - $startTime
$size = (Get-ChildItem -Recurse "distribution" -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum ?? 0
$cacheHit = if ($env:CACHE_HIT -eq "true") { "true" } else { "false" }
$metric = "{""os"":""$($env:OS_NAME)"",""ocaml"":""$($env:OCAML_VERSION)"",""duration"":$buildTime,""status"":""$($env:JOB_STATUS)"",""cache_hit"":$cacheHit,""size_bytes"":$size}"
$metric | Set-Content "metric-$env:OS_NAME-$env:OCAML_VERSION.json" -NoNewline
"metric=$metric" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 -NoNewline
' || '
end_time=$(date +%s)
BUILD_TIME=$((end_time - start_time))
SIZE_BYTES=0
if [ -d "distribution" ]; then
if [ "$(uname)" = "Darwin" ]; then
SIZE_BYTES=$(find distribution -type f -exec stat -f %z {} + 2>/dev/null | awk "{sum += \$1} END {print sum}" || echo "0")
else
SIZE_BYTES=$(du -sb distribution 2>/dev/null | cut -f1 || echo "0")
fi
fi
CACHE_HIT_VALUE="false"
if [ "$CACHE_HIT" = "true" ]; then
CACHE_HIT_VALUE="true"
fi
printf -v metric "{\"os\":\"%s\",\"ocaml\":\"%s\",\"duration\":%d,\"status\":\"%s\",\"cache_hit\":%s,\"size_bytes\":%d}" \
"$OS_NAME" "$OCAML_VERSION" "$BUILD_TIME" "$JOB_STATUS" "$CACHE_HIT_VALUE" "$SIZE_BYTES"
echo "$metric" > "metric-$OS_NAME-$OCAML_VERSION.json"
echo "metric=$metric" >> $GITHUB_OUTPUT
' }}
env:
OS_NAME: ${{ inputs.os }}
OCAML_VERSION: ${{ inputs.ocaml-version }}
JOB_STATUS: ${{ job.status }}
CACHE_HIT: ${{ inputs.cache-hit }}
# Upload Metrics
- if: inputs.command == 'collect-metrics'
uses: actions/upload-artifact@v4
with:
name: metric-${{ inputs.os }}-${{ inputs.ocaml-version }}
path: metric-${{ inputs.os }}-${{ inputs.ocaml-version }}.json
# Summary Generation
- if: inputs.command == 'generate-summary'
uses: actions/download-artifact@v4
with:
pattern: metric-*
merge-multiple: true
path: metrics
- if: inputs.command == 'generate-summary'
shell: bash
run: |
set +e
mkdir -p metrics
echo "# 🔨 Camlp5 CI Build Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
branch="${GITHUB_REF#refs/*/}"
if [[ $GITHUB_REF == refs/pull/* ]]; then
PR_NUM=$(echo $branch | cut -d/ -f1)
echo "Pull Request: [#$PR_NUM](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/$PR_NUM)" >> $GITHUB_STEP_SUMMARY
else
echo "Branch: \`$branch\`" >> $GITHUB_STEP_SUMMARY
fi
echo "Commit: [\`${GITHUB_SHA:0:7}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## 📈 Build Results Statistics" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| OS | OCaml | Status | Duration | Cache | Size |" >> $GITHUB_STEP_SUMMARY
echo "|------------|----------------|:---------:|-----------:|:--------:|---------|" >> $GITHUB_STEP_SUMMARY
find metrics -name "metric-*.json" -type f | while read -r f; do
if [ ! -f "$f" ]; then continue; fi
if ! jq -e . >/dev/null 2>&1 <<<"$(cat "$f")"; then
echo "Warning: Invalid JSON in $f" >&2
continue
fi
# Process metrics
os=$(jq -r '.os' "$f")
ocaml=$(jq -r '.ocaml' "$f")
status=$(jq -r '.status' "$f")
duration=$(jq -r '.duration' "$f")
cache_hit=$(jq -r '.cache_hit' "$f")
size=$(jq -r '.size_bytes' "$f")
status_icon=$([ "$status" = "success" ] && echo "✅" || echo "❌")
cache_icon=$([ "$cache_hit" = "true" ] && echo "✅" || echo "❌")
mins=$((duration / 60))
secs=$((duration % 60))
duration_str=$(printf "%d min %02d s" "$mins" "$secs")
if [ "$size" -ge 1073741824 ]; then
size_str=$(printf "%.1f Go" "$(echo "scale=1; $size/1073741824" | bc)")
elif [ "$size" -ge 1048576 ]; then
size_str=$(printf "%.1f Mo" "$(echo "scale=1; $size/1048576" | bc)")
else
size_str=$(printf "%.1f Ko" "$(echo "scale=1; $size/1024" | bc)")
fi
printf "| %s | %s | %s | %s | %s | %s |\n" \
"$os" "$ocaml" "$status_icon" "$duration_str" "$cache_icon" "$size_str"
done | sort -t'|' -k2,2 -k3,3 >> $GITHUB_STEP_SUMMARY
# Count builds
total_builds=${{ inputs.total-builds }}
success_builds=0
for f in metrics/metric-*.json; do
[ ! -f "$f" ] && continue
if jq -e '.status == "success"' "$f" >/dev/null 2>&1; then
((success_builds++))
fi
done
echo "" >> $GITHUB_STEP_SUMMARY
if [ "$success_builds" -eq "$total_builds" ]; then
echo "## ✅ $success_builds/$total_builds Builds Complete" >> $GITHUB_STEP_SUMMARY
else
echo "## ⚠️ $success_builds/$total_builds Builds Complete" >> $GITHUB_STEP_SUMMARY
fi
exit 0
- if: inputs.command == 'generate-summary'
shell: bash
run: rm -rf metrics/ camlp5-camlp5-buildscripts-08f6a4a/.github/workflows/ 0000775 0000000 0000000 00000000000 15204417140 0022565 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/.github/workflows/ci-cache-only.yml 0000664 0000000 0000000 00000006007 15204417140 0025726 0 ustar 00root root 0000000 0000000 name: CI-WINDOWS-CACHE-ONLY
on: [workflow_dispatch]
env:
OPAMYES: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
ocaml-compiler: [5.3.0]
setup-version: [v3]
outputs:
total_matrix_jobs: ${{ strategy.job-total || 0 }}
metric: ${{ steps.collect-metrics.outputs.metric }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Start Build Timer
uses: ./.github/actions/ci-utils
with:
command: start-timer
- name: Setup Ocaml with v3
if: matrix.setup-version == 'v3'
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: install Perl deps
if: runner.os == 'Windows'
run: |
set -x
cpan -j tools/Config.pm -T -f -i String::ShellQuote || true
cpan -j tools/Config.pm -T -f -i IPC::System::Simple || true
cpan -J
perl -MString::Shellquote -e 'print "String::ShellQuote installed\n"'
perl -MIPC::System::Simple -e 'print "IPC::System::Simple installed\n"'
shell: bash
- name: pwd
run: |
opam exec -- pwd
- name: Restore Cached Opam
id: cache-opam-restore
uses: actions/cache/restore@v4
with:
path: D:\a\camlp5-buildscripts\camlp5-buildscripts\_opam
key: windows-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}-cache
- name: Show what is cached
run: |
opam switch
opam list
opam pin list
- name: Pin some dependencies
if: matrix.setup-version == 'v3'
run: |
opam pin add --no-action ocamlfind https://github.com/chetmurthy/ocamlfind.git
opam install . --deps-only --with-doc --with-test
- name: Install dependencies
run: |
opam install --deps-only --with-test .
- name: Save Opam To Cache
id: cache-opam-save
uses: actions/cache/save@v4
with:
path: D:\a\camlp5-buildscripts\camlp5-buildscripts\_opam
key: ${{ steps.cache-opam-restore.outputs.cache-primary-key }}
- name: List packages
run: opam list
- name: Collect Build Metrics
id: collect-metrics
uses: ./.github/actions/ci-utils
with:
command: collect-metrics
os: ${{ matrix.os }}
ocaml-version: ${{ matrix.ocaml-compiler }}
cache-hit: ${{ runner.os != 'Windows' && steps.cache-opam-unix.outputs.cache-hit || steps.cache-opam-windows.outputs.cache-hit }}
build-results:
needs: [build]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate Build Summary
uses: ./.github/actions/ci-utils
with:
command: generate-summary
total-builds: ${{ needs.build.outputs.total_matrix_jobs }}
camlp5-camlp5-buildscripts-08f6a4a/.github/workflows/ci-cached-windows.yml 0000664 0000000 0000000 00000006366 15204417140 0026613 0 ustar 00root root 0000000 0000000 name: CI-CACHED-WINDOWS
on: [workflow_dispatch]
env:
OPAMYES: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
ocaml-compiler: [5.3.0]
setup-version: [v3]
outputs:
total_matrix_jobs: ${{ strategy.job-total || 0 }}
metric: ${{ steps.collect-metrics.outputs.metric }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Start Build Timer
uses: ./.github/actions/ci-utils
with:
command: start-timer
- name: Setup Ocaml with v3
if: matrix.setup-version == 'v3'
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: install Perl deps
if: runner.os == 'Windows'
run: |
set -x
cpan -j tools/Config.pm -T -f -i String::ShellQuote || true
cpan -j tools/Config.pm -T -f -i IPC::System::Simple || true
cpan -J
perl -MString::Shellquote -e 'print "String::ShellQuote installed\n"'
perl -MIPC::System::Simple -e 'print "IPC::System::Simple installed\n"'
shell: bash
- name: pwd
run: |
opam exec -- pwd
- name: Restore Cached Opam
id: cache-opam-restore
uses: actions/cache/restore@v4
with:
path: D:\a\camlp5-buildscripts\camlp5-buildscripts\_opam
key: windows-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}-cache
- name: Show what is cached
run: |
opam switch
opam list
opam pin list
- name: Pin some dependencies
if: matrix.setup-version == 'v3'
run: |
opam pin add --no-action ocamlfind https://github.com/chetmurthy/ocamlfind.git
opam install . --deps-only --with-doc --with-test
- name: Install dependencies
run: |
opam install --deps-only --with-test .
- name: Save Opam To Cache
id: cache-opam-save
uses: actions/cache/save@v4
with:
path: D:\a\camlp5-buildscripts\camlp5-buildscripts\_opam
key: ${{ steps.cache-opam-restore.outputs.cache-primary-key }}
- name: List packages
run: opam list
- name: build it
run: |
opam exec -- make sys
shell: bash
- name: test it
run: |
opam exec -- make test
shell: bash
- name: Do it with opam
run: opam install -t .
- name: Collect Build Metrics
id: collect-metrics
uses: ./.github/actions/ci-utils
with:
command: collect-metrics
os: ${{ matrix.os }}
ocaml-version: ${{ matrix.ocaml-compiler }}
cache-hit: ${{ runner.os != 'Windows' && steps.cache-opam-unix.outputs.cache-hit || steps.cache-opam-windows.outputs.cache-hit }}
build-results:
needs: [build]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate Build Summary
uses: ./.github/actions/ci-utils
with:
command: generate-summary
total-builds: ${{ needs.build.outputs.total_matrix_jobs }}
camlp5-camlp5-buildscripts-08f6a4a/.github/workflows/ci-windows.yml 0000664 0000000 0000000 00000006611 15204417140 0025377 0 ustar 00root root 0000000 0000000 name: CI-WINDOWS
on: [workflow_dispatch]
env:
OPAMYES: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
ocaml-compiler: [5.3.0]
setup-version: [v3]
outputs:
total_matrix_jobs: ${{ strategy.job-total || 0 }}
metric: ${{ steps.collect-metrics.outputs.metric }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Start Build Timer
uses: ./.github/actions/ci-utils
with:
command: start-timer
- name: Cache Opam dependencies (Unix)
id: cache-opam-unix
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: ~/.opam
key: unix-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}-${{ hashFiles('*.opam') }}-cache
restore-keys: unix-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}
- name: Cache Opam dependencies (Windows)
id: cache-opam-windows
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: D:\.opam
key: windows-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}-${{ hashFiles('*.opam') }}-cache
restore-keys: windows-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}
- name: Setup Ocaml with v3
if: matrix.setup-version == 'v3'
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: Show what is cached
run: |
opam switch
opam list
opam pin list
- name: install Perl deps
if: runner.os == 'Windows'
run: |
set -x
cpan -j tools/Config.pm -T -f -i String::ShellQuote || true
cpan -j tools/Config.pm -T -f -i IPC::System::Simple || true
cpan -J
perl -MString::Shellquote -e 'print "String::ShellQuote installed\n"'
perl -MIPC::System::Simple -e 'print "IPC::System::Simple installed\n"'
shell: bash
- name: Pin some dependencies
if: matrix.setup-version == 'v3'
run: |
opam pin add --no-action ocamlfind https://github.com/chetmurthy/ocamlfind.git
opam install . --deps-only --with-doc --with-test
- name: Install dependencies
run: |
opam install --deps-only --with-test .
- name: build it
run: |
opam exec -- make sys
shell: bash
- name: test it
run: |
opam exec -- make test
shell: bash
- name: Do it with opam
run: opam install -t .
- name: Collect Build Metrics
id: collect-metrics
uses: ./.github/actions/ci-utils
with:
command: collect-metrics
os: ${{ matrix.os }}
ocaml-version: ${{ matrix.ocaml-compiler }}
cache-hit: ${{ runner.os != 'Windows' && steps.cache-opam-unix.outputs.cache-hit || steps.cache-opam-windows.outputs.cache-hit }}
build-results:
needs: [build]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate Build Summary
uses: ./.github/actions/ci-utils
with:
command: generate-summary
total-builds: ${{ needs.build.outputs.total_matrix_jobs }}
camlp5-camlp5-buildscripts-08f6a4a/.github/workflows/ci.yml 0000664 0000000 0000000 00000006641 15204417140 0023712 0 ustar 00root root 0000000 0000000 name: CI
on: [workflow_dispatch]
env:
OPAMYES: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15, windows-latest]
ocaml-compiler: [4.14.2, 5.3.0]
setup-version: [v3]
outputs:
total_matrix_jobs: ${{ strategy.job-total || 0 }}
metric: ${{ steps.collect-metrics.outputs.metric }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Start Build Timer
uses: ./.github/actions/ci-utils
with:
command: start-timer
- name: Cache Opam dependencies (Unix)
id: cache-opam-unix
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: ~/.opam
key: unix-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}-${{ hashFiles('*.opam') }}-cache
restore-keys: unix-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}
- name: Cache Opam dependencies (Windows)
id: cache-opam-windows
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: D:\.opam
key: windows-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}-${{ hashFiles('*.opam') }}-cache
restore-keys: windows-${{ matrix.ocaml-compiler }}-with-test-${{ matrix.setup-version }}
- name: Setup Ocaml with v3
if: matrix.setup-version == 'v3'
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: Show what is cached
run: |
opam switch
opam list
opam pin list
- name: install Perl deps
if: runner.os == 'Windows'
run: |
set -x
cpan -j tools/Config.pm -T -f -i String::ShellQuote || true
cpan -j tools/Config.pm -T -f -i IPC::System::Simple || true
cpan -J
perl -MString::Shellquote -e 'print "String::ShellQuote installed\n"'
perl -MIPC::System::Simple -e 'print "IPC::System::Simple installed\n"'
shell: bash
- name: Pin some dependencies
if: matrix.setup-version == 'v3'
run: |
opam pin add --no-action ocamlfind https://github.com/chetmurthy/ocamlfind.git
opam install . --deps-only --with-doc --with-test
- name: Install dependencies
run: |
opam install --deps-only --with-test .
- name: build it
run: |
opam exec -- make sys
shell: bash
- name: test it
run: |
opam exec -- make test
shell: bash
- name: Do it with opam
run: opam install -t .
- name: Collect Build Metrics
id: collect-metrics
uses: ./.github/actions/ci-utils
with:
command: collect-metrics
os: ${{ matrix.os }}
ocaml-version: ${{ matrix.ocaml-compiler }}
cache-hit: ${{ runner.os != 'Windows' && steps.cache-opam-unix.outputs.cache-hit || steps.cache-opam-windows.outputs.cache-hit }}
build-results:
needs: [build]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate Build Summary
uses: ./.github/actions/ci-utils
with:
command: generate-summary
total-builds: ${{ needs.build.outputs.total_matrix_jobs }}
camlp5-camlp5-buildscripts-08f6a4a/.gitignore 0000664 0000000 0000000 00000000044 15204417140 0021156 0 ustar 00root root 0000000 0000000 *.cm*
local-install
*.bak
*.NEW
*.o
camlp5-camlp5-buildscripts-08f6a4a/CHANGES 0000664 0000000 0000000 00000003514 15204417140 0020166 0 ustar 00root root 0000000 0000000 camlp5-buildscripts Version 0.07
--------------------------------
* [23 May 2026] minor changes to allow coexisting w/bos 0.3.0, ocaml 5.5
camlp5-buildscripts Version 0.06
--------------------------------
* [28 Mar 2025] More Windows fixes.
- Windows' `Unix.execvp` doesn't work like Unix's. Replace with `Unix.system`.
- Add a bunch of tests.
- Add Github CI to test it all on Windows.
- On Windows only, restore the Perl script for LAUNCH (LAUNCH.PL),
associated tests, and the system-package dependencies for it, so
that when something else breaks on Windows, we can switch back to
Perl.
camlp5-buildscripts Version 0.05
--------------------------------
* [19 Mar 2025] more fixups to try to make this work on Windows
camlp5-buildscripts Version 0.04
-------------------
* [13 Dec 2024] tiny fixup for Makefile, to support Windows. Thanks to @tobil4sk for this!
camlp5-buildscripts Version 0.03
-------------------
* [22 Jul 2023] Stupid, stupid, stupid error in ya-wrap-ocamlfind (was ignoring return-code from invoked command)
This caused errors in builds in pa_ppx* packages to be silently ignored. Ugh. What idiocy. Fixed.
This means that older pa_ppx* packages cannot build with this package/version. But it's only b/c they
enable "debugging preprocessing" by default. If that's disabled, then they build fine. But still, what
a mess.
That this is such a tiny error is even more maddening.
camlp5-buildscripts Version 0.02
-------------------
* [30 Jan 2023] some small changes
ya-wrap-ocamlfind: change syntax of header comment to "(**pp ... *)"
join_meta: reverse order of subdirs for wrap-subdirs, so more comprehensible to invokers
all: change bootstrap to not generate static blocks, switch to pa_ppx_regexp
camlp5-buildscripts Version 0.01
-------------------
* [30 Jan 2023] First release
camlp5-camlp5-buildscripts-08f6a4a/LICENSE 0000664 0000000 0000000 00000002053 15204417140 0020175 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2023 chetmurthy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
camlp5-camlp5-buildscripts-08f6a4a/Makefile 0000664 0000000 0000000 00000001240 15204417140 0020625 0 ustar 00root root 0000000 0000000
SYSDIRS= src
TESTDIRS= test
OCAMLFIND=ocamlfind
all: sys
sys:
set -e; for i in $(SYSDIRS); do cd $$i; $(MAKE) all; cd ..; done
test: all
mkdir -p local-install/bin
set -e; for i in $(TESTDIRS); do cd $$i; $(MAKE) all; cd ..; done
set -e; for i in $(TESTDIRS); do cd $$i; $(MAKE) test; cd ..; done
bootstrap:
$(MAKE) -C pa_ppx_src bootstrap
install: all
$(OCAMLFIND) remove camlp5-buildscripts || true
$(OCAMLFIND) install camlp5-buildscripts local-install/lib/camlp5-buildscripts/*
uninstall:
$(OCAMLFIND) remove camlp5-buildscripts || true
clean::
set -e; for i in $(SYSDIRS) $(TESTDIRS); do cd $$i; $(MAKE) clean; cd ..; done
rm -rf docs local-install
camlp5-camlp5-buildscripts-08f6a4a/README.asciidoc 0000664 0000000 0000000 00000011223 15204417140 0021624 0 ustar 00root root 0000000 0000000 camlp5-buildscripts: Sysadmin scripts for Camlp5 projects
=========================================================
This package is at version 0.07.
Sysadmin scripts written in OCaml (and Perl precursors), for use with
Camlp5 and Camlp5-based projects. In previous versions (<= 0.05) the
Perl scripts had been eliminated, but with a Windows port, it became
clear that OCaml's `Unix` package on Windows is .... not sufficiently
reliable to be a replacement for Perl. So I've resurrected the Perl
script for `LAUNCH` (`LAUNCH.PL`).
To be clear: these Perl scripts/packages are only needed on Windows;
on UNIX, they aren't installed or required.
== Installation
On UNIX the Perl prereqs are unnecessary, so
```
$ opam install camlp5-buildscripts
```
suffices. On Windows, we need:
* IPC::System::Simple
* String::ShellQuote
The latter is not packaged by Cygwin. To install them, you will need
to use the Perl `cpan` too. You can look in
`.github/workflows/ci-windows.yml` (the step "install Perl deps") for
an automated exampleof how to do it.
== Invocation
The scripts are not installed in a bin-directory, but rather in the
package's directory. So to invoke, we use the ocamlfind "exe" syntax. For example, to invoke "fixin":
```
ocamlfind camlp5-buildscripts/fixin .... args ....
```
== The Scripts
`fixin`::
"fixes" the `#!` line of a script so that it points at an executable
on the current `PATH`. That is, if the #! line is
```
#!perl
```
then it will be rewritten to the full-path of the `perl` that is found
on the current `PATH`.
`join_meta`::
Joins up a bunch of `META` files into a single `META` file. The idea
is, you have a bunch of subdirectories, each of which installs a subpackage.
One of those subpackages might actually be the "main" package, and you
want the other subdirectories' META files to become subpackages in the
new META file you're constructing. And at the same time, you'll want
to rewrite names of those subpackages. For example, if your target
package is `pa_ppx_regexp`, and you have two subdirectories:
* `pa_perl` which installs a package `pa_ppx_regexp`
* `runtime` which installs a package `pa_ppx_regexp_runtime`
then you might want to build a composite `META` file that is based on
that of `pa_perl`, but has `runtime`'s `META` file as a subpackage,
named `"runtime"`. And then you'd want to replace all instances of
`pa_ppx_regexp_runtime` with `pa_ppx_regexp.runtime` (notice "_" changes
to ".") but only in `require` statements.
`join_meta` does the above. Its usage:
```
join_meta -destdir
-direct-include directly include /META file
-wrap-subdir : include /META file wrapped as subpackage
-rewrite : rewrite packages named to in `require' statements
-help Display this list of options
--help Display this list of options
```
It assumes that every subdirectory has a `META` file already-created,
and joins them up, outputing the result to stdout.
`ya-wrap-ocamlfind`::
"yet another ocamlfind wrapper". No doco yet.
`LAUNCH`::
`LAUNCH` assumes (and noisily fails if not present) there is an
environment variable `TOP` that is either a relative or absolute
reference to the top-level directory of the current project. It adds
`$(TOP)/local-install/bin` to the `PATH` and sets `OCAMLPATH` to
`$(TOP)/local-install/lib:` -- IF these directories exist. This is
useful for running `ocamlfind` commands that use the
`$(TOP)/local-install` directory as a local installation-directory
(hence no need to pollute global install-directories with package
installation during complex multi-step builds. This means that when
running tests (and multistep builds), we can assume that already-built
packages are "installed" and can use `ocamlfind` to access them.
`LAUNCH` is invoked thus:
```
ocamlfind camlp5-buildscripts/LAUNCH -v --
```
Note that the `--` is mandatory.
== Maintenance
There are two directories containing these scripts: `pa_ppx_src` and
`src`. The former directory contains scripts that are written using
`pa_ppx_regexp` and whatever other PPX rewriters one might desire. The
latter directory contains those same scripts, but after expansion via
`not-ocamlfind preprocess` The "make all install" process only builds
the scripts in `src`, so PPX rewriters are not necessary to build and
install this project -- which is the point, so that this project can
be used as build-scripts in `camlp5` and various PPX rewriter
projects.
There is a "bootstrap" target in the toplevel that will update the
scripts in `src` if they are out-of-date w.r.t. the versions in
`pa_ppx_src`, but it should be a no-op unless being used by the
maintainer of this package.
camlp5-camlp5-buildscripts-08f6a4a/opam 0000664 0000000 0000000 00000002620 15204417140 0020047 0 ustar 00root root 0000000 0000000 version: "0.07"
synopsis: "Camlp5 Build scripts (written in OCaml)"
description:
"""
These are build-scripts that are helpful in building Camlp5 and packages based on Camlp5.
As such, they need to *not* depend on Camlp5. The command are *not* installed in a
bin-directory, but in the package-directory, hence invoked via the "ocamlfind package/exe"
method.
"""
opam-version: "2.0"
x-maintenance-intent: [ "(latest)" ]
maintainer: "Chet Murthy "
authors: ["Chet Murthy"]
homepage: "https://github.com/camlp5/camlp5-buildscripts"
license: "BSD-3-Clause"
bug-reports: "https://github.com/camlp5/camlp5-buildscripts/issues"
dev-repo: "git+https://github.com/camlp5/camlp5-buildscripts.git"
doc: "https://github.com/camlp5/camlp5-buildscripts/doc"
depends: [
"ocaml" { >= "4.10.0" }
"not-ocamlfind" { >= "0.01" }
"mdx" { with-test & >= "2.2.1" }
"conf-perl-ipc-system-simple" { >= "3" & os-family = "windows" }
"conf-perl-string-shellquote" { >= "3" & os-family = "windows" }
"conf-diffutils" { with-test & (os-distribution = "alpine" | os-distribution = "freebsd") }
"fmt"
"re" { >= "1.10.4" }
"bos" { >= "0.2.1" }
"rresult" { >= "0.7.0" }
]
build: [
[make "sys"]
[make "test"] {with-test}
]
install: [make "install"]
conflicts: [
"ocaml-option-bytecode-only"
]
x-ci-accept-failures: [
"opensuse-tumbleweed"
"freebsd"
]
url {
src: ""
checksum: [
"sha512="
]
}
camlp5-camlp5-buildscripts-08f6a4a/pa_ppx_src/ 0000775 0000000 0000000 00000000000 15204417140 0021326 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/pa_ppx_src/LAUNCH.ml 0000664 0000000 0000000 00000004627 15204417140 0022643 0 ustar 00root root 0000000 0000000
open Rresult
open Bos
open Fpath
let push l x = (l := x :: !l)
let verbose = ref false ;;
let veryverbose = ref false ;;
let cmd = ref [] ;;
Arg.(parse [
"-v", (Set verbose),"verbose output"
; "-vv", Set veryverbose, "very verbose output"
; "--", Rest (fun s -> cmd := !cmd @ [s]), "the command"
]
(fun s -> cmd := !cmd @ [s])
"LAUNCH [-v] [--] "
) ;;
let ( let* ) x f = Rresult.(>>=) x f
let exists_directory p = Sys.file_exists p && Sys.is_directory p
let main () =
let* top =
match OS.Env.var "TOP" with
Some v -> Ok v
| None -> Error (`Msg "LAUNCH: environment variable TOP *must* be set to use this wrapper") in
let ocamlpath_pathsep =
(match Sys.os_type with
"Unix" -> ":"
| _ -> ";") in
let path_pathsep =
(match Sys.os_type with
"Unix" -> ":"
| _ -> ";") in
let newbindir = [%pattern {|${top}/local-install/bin|}] in
let newlibdir = [%pattern {|${top}/local-install/lib|}] in
let* () =
if exists_directory newbindir then
let* path = OS.Env.req_var "PATH" in
let newpath = [%pattern {|${newbindir}${path_pathsep}${path}|}] in
if !veryverbose then
Fmt.(pf stderr "LAUNCH: PATH=%a\n%!" Dump.string newpath) ;
OS.Env.set_var "PATH" (Some newpath)
else Ok() in
let* () =
if exists_directory newlibdir then
let newcamlpath = [%pattern {|${newlibdir}${ocamlpath_pathsep}|}] in
if !veryverbose then
Fmt.(pf stderr "LAUNCH: OCAMLPATH=%a\n%!" Dump.string newcamlpath) ;
OS.Env.set_var "OCAMLPATH" (Some newcamlpath)
else Ok() in
match !cmd with
exe :: _ ->
begin
let cmd = !cmd in
let cmd = Filename.quote_command (List.hd cmd) (List.tl cmd) in
if !verbose || !veryverbose then
Fmt.(pf stderr "LAUNCH: command %s\n%!" cmd);
let st = Unix.system cmd in
match st with
Unix.WEXITED 0 -> Ok ()
| Unix.WEXITED n -> exit n
| WSIGNALED n ->
Error
(`Msg
(Printf.sprintf "LAUNCH: command killed by signal %d" n))
| WSTOPPED n ->
Error
(`Msg
(Printf.sprintf "LAUNCH: command stopped by signal %d" n))
end
| _ -> Error (`Msg "LAUNCH: at least one argument (the command-name) must be provided")
;;
try R.failwith_error_msg (main ())
with exc ->
Fmt.(pf stderr "%a\n%!" exn exc) ; exit 1
camlp5-camlp5-buildscripts-08f6a4a/pa_ppx_src/Makefile 0000664 0000000 0000000 00000000454 15204417140 0022771 0 ustar 00root root 0000000 0000000
NOT_OCAMLFIND=not-ocamlfind
bootstrap: ../src/join_meta.ml ../src/ya_wrap_ocamlfind.ml ../src/fixin.ml ../src/LAUNCH.ml
../src/%.ml: %.ml
$(NOT_OCAMLFIND) preprocess -package pa_ppx_regexp,camlp5.pr_o -ppopt -pa_ppx_regexp-nostatic -syntax camlp5o $< > $@.NEW && \
mv $@.NEW $@
.SUFFIXES: .ml
camlp5-camlp5-buildscripts-08f6a4a/pa_ppx_src/fixin.ml 0000664 0000000 0000000 00000003167 15204417140 0023004 0 ustar 00root root 0000000 0000000 (** -syntax camlp5o *)
let push l x = (l := x :: !l)
open Rresult
open Bos
let read_fully ifile =
OS.File.read ifile
let write_fully ~mode ofile txt =
OS.File.write ~mode ofile txt
let ( let* ) x f = Rresult.(>>=) x f
;;
let verbose = ref true ;;
let files = ref [] ;;
Arg.(parse [
"-s", (Arg.Clear verbose),
("silence verbosity")
]
(fun s -> push files s)
"fixin [-s] ")
;;
let search_path =
let dirs = String.split_on_char ':' (Sys.getenv "PATH") in
List.map Fpath.v dirs
let fix_interpreter ~f (exedir, exename) =
let open Fpath in
let exename = v exename in
let candidates = List.map (fun dir -> append dir exename) search_path in
match List.find_opt OS.File.is_executable candidates with
None ->
if !verbose then Fmt.(pf stderr "Can't find %a in PATH, %a unchanged\n%!" pp exename pp f) ;
to_string (append (v exedir) exename)
| Some v ->
if !verbose then Fmt.(pf stderr "Changing %a to %a\n%!" pp f pp v) ;
to_string v
let fixin_contents ~f txt =
let txt = [%subst {|^#!([\S]+/)?([\S]+)|} / {|"#!" ^ (fix_interpreter ~f ($1$, $2$))|} /s e] txt in
Ok txt
let fixin1 f =
let open Fpath in
let f = v f in
let newf = add_ext "NEW" f in
let bakf = add_ext "bak" f in
let* st = OS.Path.stat f in
let mode = st.Unix.st_perm in
let* contents = read_fully f in
let* contents = fixin_contents ~f contents in
let* () = write_fully ~mode newf contents in
let* () = OS.Path.move ~force:true f bakf in
let* () = OS.Path.move ~force:true newf f in
Ok ()
;;
!files
|> List.iter (fun f ->
fixin1 f |> R.failwith_error_msg
)
;;
camlp5-camlp5-buildscripts-08f6a4a/pa_ppx_src/join_meta.ml 0000664 0000000 0000000 00000004772 15204417140 0023637 0 ustar 00root root 0000000 0000000 (** -syntax camlp5o *)
open Rresult
open Bos
open Fpath
let read_fully ifile =
OS.File.read ifile
let ( let* ) x f = Rresult.(>>=) x f
;;
let push l x = (l := x :: !l)
let read_ic_fully ?(msg="") ?(channel=stdin) () =
let fd = Unix.descr_of_in_channel channel in
if Unix.isatty fd && msg <> "" then begin
Printf.printf "%s\n" msg ; flush stdout ;
end ;
let b = Buffer.create 23 in
let rec rrec () =
match try Some(input_char channel)
with End_of_file -> None with
None -> Buffer.contents b
| Some c -> Buffer.add_char b c ; rrec ()
in
rrec()
let pkgmap = ref []
let direct_include = ref ""
let wrap_subdirs = ref []
let split2 ~msg s =
match [%match {|^([^:]+):([^:]+)$|} / strings (!1,!2)] s with
Some (name, subdir) -> (name, subdir)
| _ -> failwith Fmt.(str "%s: invalid arg <<%s>>" msg s)
;;
Arg.(parse [
"-direct-include", (Arg.Set_string direct_include),
(" directly include /META file")
;"-wrap-subdir", (Arg.String (fun s -> push wrap_subdirs (split2 ~msg:"wrap-subdir" s))),
(": include /META file wrapped as subpackage ")
;"-rewrite", (Arg.String (fun s -> push pkgmap (split2 ~msg:"rewrite" s))),
(": rewrite packages named to in `require' statements")
]
(fun _ -> failwith "join_meta: no anonymous args supported")
"join_meta -destdir ")
;;
let indent n txt =
let pfx = String.make n ' ' in
[%subst {|^|} / {|${pfx}|} / g m] txt
let fix txt =
let l = [%split {|\s*,\s*|}] txt in
let f s =
match List.assoc s !pkgmap with
exception Not_found -> s
| v -> v in
let ol =
l
|> List.map (fun p ->
[%subst {|^([^.]+)|} / {| f $1$ |} / e] p
) in
String.concat "," ol
let fix0 txt =
[%subst {|"([^"]+)"|} / {| "\"" ^ fix($1$) ^ "\"" |} / e] txt
let fixdeps txt =
[%subst {|^(.*require.*)$|} / {| fix0($1$) |} / m g e] txt
let capturex (cmd, args) =
let channel = Unix.open_process_args_in cmd args in
let txt = read_ic_fully ~channel () in
close_in channel ;
txt
;;
if !direct_include <> "" then
print_string (indent 2 (fixdeps(R.failwith_error_msg (read_fully (v [%pattern {|./${!direct_include}/META|}])))))
;;
!wrap_subdirs
|> List.rev
|> List.iter (fun (name, subdir) ->
let txt = indent 2 (fixdeps(R.failwith_error_msg (read_fully (v [%pattern {|./${subdir}/META|}])))) in
print_string [%pattern {|
package "${name}" (
${txt}
)
|}]
)
;;
camlp5-camlp5-buildscripts-08f6a4a/pa_ppx_src/ya_wrap_ocamlfind.ml 0000664 0000000 0000000 00000002700 15204417140 0025335 0 ustar 00root root 0000000 0000000 (** -syntax camlp5o *)
let rec split_args cmd = function
| "--" :: files -> List.rev cmd, files
| [file] -> List.rev cmd, [file]
| arg :: args -> split_args (arg :: cmd) args
| [] -> failwith "please supply input arguments"
let split_args = split_args []
let envsubst s =
let envlookup vname =
match Sys.getenv_opt vname with
Some v -> v
| None -> failwith [%pattern {|ya_wrap_ocamlfind: environment variable <<${vname}>> not found|}] in
let f s1 s2 =
if s1 <> "" then envlookup s1
else if s2 <> "" then envlookup s2
else assert false in
[%subst {|(?:\$\(([^)]+)\)|\$\{([^}]+)\})|} / {| f $1$ $2$ |} / g e] s
let discover_args f =
let f' = open_in f in
let rec drec () =
let line1 = input_line f' in
match ([%match {|^\s+$|} / pred] line1,
[%match {|^#.*$|} / pred] line1,
[%match {|^\(\*\*pp (.*?)\*\)|} / strings !1] line1) with
| (true, _, _) -> drec ()
| (_, true, _) -> drec ()
| (_, _, None) -> ""
| (_, _, Some params) -> envsubst params in
let rv = drec () in
close_in f';
rv
let () =
let cmd, files =
Array.to_list Sys.argv |> List.tl |> split_args in
let cmd = Filename.quote_command (List.hd cmd) (List.tl cmd) in
List.iter (fun f ->
let extra = discover_args f in
let cmd = [%pattern {|${cmd} ${extra} ${f}|}] in
Printf.fprintf stderr "%s\n%!" cmd;
let rc = Sys.command cmd in
if rc <> 0 then exit rc
)
files
camlp5-camlp5-buildscripts-08f6a4a/src/ 0000775 0000000 0000000 00000000000 15204417140 0017757 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/src/.gitignore 0000664 0000000 0000000 00000000051 15204417140 0021743 0 ustar 00root root 0000000 0000000 fixin
join_meta
ya-wrap-ocamlfind
LAUNCH
camlp5-camlp5-buildscripts-08f6a4a/src/LAUNCH.PL 0000775 0000000 0000000 00000002715 15204417140 0021176 0 ustar 00root root 0000000 0000000 #!/usr/bin/env perl
use strict ;
use IPC::System::Simple qw(systemx runx capturex $EXITVAL);
use String::ShellQuote ;
use File::Basename;
our $verbose = 0 ;
our $ocamlpath_pathsep ;
our $path_pathsep ;
while(@ARGV) {
if ($ARGV[0] eq '-v') {
shift @ARGV ;
$verbose = 1 ;
}
elsif ($ARGV[0] eq '-vv') {
shift @ARGV ;
$verbose = 2 ;
}
else { last ; }
}
{
my $wd = dirname(dirname($0)) ;
my $top = $ENV{'TOP'} || die "environment variable TOP MUST be set" ;
print STDERR "OS: <<$^O>>\n" if $main::verbose > 1;
if ($^O eq 'MSWin32' || $^O eq 'cygwin') {
$ocamlpath_pathsep = ";";
}
else {
$ocamlpath_pathsep = ":";
}
$path_pathsep = ":" ;
my $newbindir = "${top}/local-install/bin";
my $newlibdir = "${top}/local-install/lib";
if (-d $newbindir) {
$ENV{'PATH'} = "${newbindir}${path_pathsep}$ENV{'PATH'}" ;
print STDERR ("LAUNCH: PATH=".shell_quote($ENV{'PATH'})."\n") if $main::verbose > 1;
}
if (-d $newlibdir) {
$ENV{'OCAMLPATH'} = "$top/local-install/lib${ocamlpath_pathsep}" ;
print STDERR ("LAUNCH: OCAMLPATH=".shell_quote($ENV{'OCAMLPATH'})."\n") if $main::verbose > 1;
}
v_systemx([0], [@ARGV]) ;
}
sub v_systemx {
croak( "v_systemx: must specify exit codes") unless (ref($_[0]) eq 'ARRAY') ;
my $codes = shift ;
my @cmd = @{ shift @_ } ;
my %args = @_ ;
print STDERR join(' ', "LAUNCH:", map { shell_quote($_) } @cmd)."\n" if $main::verbose > 0;
return runx($codes, @cmd) ;
}
camlp5-camlp5-buildscripts-08f6a4a/src/LAUNCH.ml 0000664 0000000 0000000 00000004627 15204417140 0021274 0 ustar 00root root 0000000 0000000
open Rresult
open Bos
open Fpath
let push l x = l := x :: !l
let verbose = ref false
let veryverbose = ref false
let cmd = ref []
let _ =
Arg.
(parse
["-v", Set verbose, "verbose output";
"-vv", Set veryverbose, "very verbose output";
"--", Rest (fun s -> cmd := !cmd @ [s]), "the command"]
(fun s -> cmd := !cmd @ [s]) "LAUNCH [-v] [--] ")
let ( let* ) x f = Rresult.(>>=) x f
let exists_directory p = Sys.file_exists p && Sys.is_directory p
let main () =
let* top =
match OS.Env.var "TOP" with
Some v -> Ok v
| None ->
Error
(`Msg
"LAUNCH: environment variable TOP *must* be set to use this wrapper")
in
let ocamlpath_pathsep =
match Sys.os_type with
"Unix" -> ":"
| _ -> ";"
in
let path_pathsep =
match Sys.os_type with
"Unix" -> ":"
| _ -> ";"
in
let newbindir = String.concat "" [top; "/local-install/bin"] in
let newlibdir = String.concat "" [top; "/local-install/lib"] in
let* () =
if exists_directory newbindir then
let* path = OS.Env.req_var "PATH" in
let newpath =
String.concat "" [newbindir; ""; path_pathsep; ""; path]
in
if !veryverbose then
Fmt.(pf stderr "LAUNCH: PATH=%a\n%!" Dump.string newpath);
OS.Env.set_var "PATH" (Some newpath)
else Ok ()
in
let* () =
if exists_directory newlibdir then
let newcamlpath = String.concat "" [newlibdir; ""; ocamlpath_pathsep] in
if !veryverbose then
Fmt.(pf stderr "LAUNCH: OCAMLPATH=%a\n%!" Dump.string newcamlpath);
OS.Env.set_var "OCAMLPATH" (Some newcamlpath)
else Ok ()
in
match !cmd with
exe :: _ ->
let cmd = !cmd in
let cmd = Filename.quote_command (List.hd cmd) (List.tl cmd) in
if !verbose || !veryverbose then
Fmt.(pf stderr "LAUNCH: command %s\n%!" cmd);
let st = Unix.system cmd in
begin match st with
Unix.WEXITED 0 -> Ok ()
| Unix.WEXITED n -> exit n
| WSIGNALED n ->
Error
(`Msg (Printf.sprintf "LAUNCH: command killed by signal %d" n))
| WSTOPPED n ->
Error
(`Msg (Printf.sprintf "LAUNCH: command stopped by signal %d" n))
end
| _ ->
Error
(`Msg
"LAUNCH: at least one argument (the command-name) must be provided")
let _ =
try R.failwith_error_msg (main ()) with
exc -> Fmt.(pf stderr "%a\n%!" exn exc); exit 1
camlp5-camlp5-buildscripts-08f6a4a/src/Makefile 0000664 0000000 0000000 00000001717 15204417140 0021425 0 ustar 00root root 0000000 0000000 ifeq ($(OS),Windows_NT)
WD=$(shell cygpath --absolute --windows .)
EXE=.exe
else
WD=$(shell pwd)
EXE=
endif
TOP=..
NOT_OCAMLFIND=not-ocamlfind
OCAMLFIND=ocamlfind
PACKAGES=re,fmt,unix,bos,rresult
BIN=ya-wrap-ocamlfind$(EXE) fixin$(EXE) join_meta$(EXE) LAUNCH$(EXE)
ifeq ($(OS),Windows_NT)
PL=LAUNCH.PL
endif
all: $(BIN)
$(MAKE) DESTDIR=$(WD)/$(TOP)/local-install/ install
ya-wrap-ocamlfind$(EXE): ya_wrap_ocamlfind.ml
$(OCAMLFIND) ocamlc -linkpkg -linkall -package $(PACKAGES) $< -o $@
join_meta$(EXE): join_meta.ml
$(OCAMLFIND) ocamlc -linkpkg -linkall -package $(PACKAGES) $< -o $@
fixin$(EXE): fixin.ml
$(OCAMLFIND) ocamlc -linkpkg -linkall -package $(PACKAGES) $< -o $@
LAUNCH$(EXE): LAUNCH.ml
$(OCAMLFIND) ocamlc -linkpkg -linkall -package $(PACKAGES) $< -o $@
install::
mkdir -p $(DESTDIR)/lib
touch META
$(NOT_OCAMLFIND) reinstall-if-diff camlp5-buildscripts -destdir $(DESTDIR)/lib META $(BIN) $(PL)
rm -f META
clean::
rm -f *.bak *.cm* $(BIN) META
camlp5-camlp5-buildscripts-08f6a4a/src/fixin.PL 0000775 0000000 0000000 00000003726 15204417140 0021344 0 ustar 00root root 0000000 0000000 #!/usr/bin/perl
# Usage: fixin [-s] [files]
# Configuration constants.
$does_shbang = 1; # Does kernel recognize #! hack?
$verbose = 1; # Default to verbose
# Construct list of directories to search.
@absdirs = reverse grep(m!^/!, split(/:/, $ENV{'PATH'}, 999));
# Process command line arguments.
if ($ARGV[0] eq '-s') {
shift;
$verbose = 0;
}
die "Usage: fixin [-s] [files]\n" unless @ARGV || !-t;
@ARGV = '-' unless @ARGV;
# Now do each file.
FILE: foreach $filename (@ARGV) {
open(IN, $filename) ||
((warn "Can't process $filename: $!\n"), next);
$_ = ;
next FILE unless /^#!/; # Not a shbang file.
# Now figure out the interpreter name.
chop($cmd = $_);
$cmd =~ s/^#! *//;
($cmd,$arg) = split(' ', $cmd, 2);
$cmd =~ s!^.*/!!;
# Now look (in reverse) for interpreter in absolute PATH.
$found = '';
foreach $dir (@absdirs) {
if (-x "$dir/$cmd") {
warn "Ignoring $found\n" if $verbose && $found;
$found = "$dir/$cmd";
}
}
# Figure out how to invoke interpreter on this machine.
if ($found) {
warn "Changing $filename to $found\n" if $verbose;
if ($does_shbang) {
$_ = "#!$found";
$_ .= ' ' . $arg if $arg ne '';
$_ .= "\n";
}
else {
$_ = <$filename")
|| die "Can't create new $filename: $!\n";
($dev,$ino,$mode) = stat IN;
$mode = 0755 unless $dev;
chmod $mode, $filename;
select(OUT);
}
# Print out the new #! line (or equivalent).
print;
# Copy the rest of the file.
while () {
print;
}
close IN;
close OUT;
}
camlp5-camlp5-buildscripts-08f6a4a/src/fixin.ml 0000664 0000000 0000000 00000003567 15204417140 0021441 0 ustar 00root root 0000000 0000000 (** -syntax camlp5o *)
let push l x = l := x :: !l
open Rresult
open Bos
let read_fully ifile = OS.File.read ifile
let write_fully ~mode ofile txt = OS.File.write ~mode ofile txt
let ( let* ) x f = Rresult.(>>=) x f
let verbose = ref true
let files = ref []
let _ =
Arg.
(parse ["-s", Arg.Clear verbose, "silence verbosity"]
(fun s -> push files s) "fixin [-s] ")
let search_path =
let dirs = String.split_on_char ':' (Sys.getenv "PATH") in
List.map Fpath.v dirs
let fix_interpreter ~f (exedir, exename) =
let open Fpath in
let exename = v exename in
let candidates = List.map (fun dir -> append dir exename) search_path in
match List.find_opt OS.File.is_executable candidates with
None ->
if !verbose then
Fmt.
(pf stderr "Can't find %a in PATH, %a unchanged\n%!" pp exename pp f);
to_string (append (v exedir) exename)
| Some v ->
if !verbose then Fmt.(pf stderr "Changing %a to %a\n%!" pp f pp v);
to_string v
let fixin_contents ~f txt =
let txt =
Re.replace ~all:false
(Re.Perl.compile_pat ~opts:[`Dotall] "^#!([\\S]+/)?([\\S]+)")
~f:(fun __g__ ->
"#!" ^
fix_interpreter ~f
((match Re.Group.get_opt __g__ 1 with
None -> ""
| Some s -> s),
(match Re.Group.get_opt __g__ 2 with
None -> ""
| Some s -> s)))
txt
in
Ok txt
let fixin1 f =
let open Fpath in
let f = v f in
let newf = add_ext "NEW" f in
let bakf = add_ext "bak" f in
let* st = OS.Path.stat f in
let mode = st.Unix.st_perm in
let* contents = read_fully f in
let* contents = fixin_contents ~f contents in
let* () = write_fully ~mode newf contents in
let* () = OS.Path.move ~force:true f bakf in
let* () = OS.Path.move ~force:true newf f in Ok ()
let _ = !files |> List.iter (fun f -> fixin1 f |> R.failwith_error_msg)
camlp5-camlp5-buildscripts-08f6a4a/src/join_meta.ml 0000664 0000000 0000000 00000007154 15204417140 0022265 0 ustar 00root root 0000000 0000000 (** -syntax camlp5o *)
open Rresult
open Bos
open Fpath
let read_fully ifile = OS.File.read ifile
let ( let* ) x f = Rresult.(>>=) x f
let push l x = l := x :: !l
let read_ic_fully ?(msg = "") ?(channel = stdin) () =
let fd = Unix.descr_of_in_channel channel in
if Unix.isatty fd && msg <> "" then
begin Printf.printf "%s\n" msg; flush stdout end;
let b = Buffer.create 23 in
let rec rrec () =
match try Some (input_char channel) with End_of_file -> None with
None -> Buffer.contents b
| Some c -> Buffer.add_char b c; rrec ()
in
rrec ()
let pkgmap = ref []
let direct_include = ref ""
let wrap_subdirs = ref []
let split2 ~msg s =
match
(let __re__ = Re.Perl.compile_pat ~opts:[] "^([^:]+):([^:]+)$" in
fun __subj__ ->
match
Option.map (fun __g__ -> Re.Group.get __g__ 1, Re.Group.get __g__ 2)
(Re.exec_opt __re__ __subj__)
with
exception Not_found -> None
| rv -> rv)
s
with
Some (name, subdir) -> name, subdir
| _ -> failwith Fmt.(str "%s: invalid arg <<%s>>" msg s)
let _ =
Arg.
(parse
["-direct-include", Arg.Set_string direct_include,
" directly include /META file";
"-wrap-subdir",
Arg.String (fun s -> push wrap_subdirs (split2 ~msg:"wrap-subdir" s)),
": include /META file wrapped as subpackage ";
"-rewrite", Arg.String (fun s -> push pkgmap (split2 ~msg:"rewrite" s)),
": rewrite packages named to in `require' statements"]
(fun _ -> failwith "join_meta: no anonymous args supported")
"join_meta -destdir ")
let indent n txt =
let pfx = String.make n ' ' in
Re.replace ~all:true (Re.Perl.compile_pat ~opts:[`Multiline] "^")
~f:(fun __g__ -> String.concat "" [pfx]) txt
let fix txt =
let l =
(let __re__ = Re.Perl.compile_pat ~opts:[] "\\s*,\\s*" in
fun __subj__ -> Re.split __re__ __subj__)
txt
in
let f s =
match List.assoc s !pkgmap with
exception Not_found -> s
| v -> v
in
let ol =
l |>
List.map
(fun p ->
Re.replace ~all:false (Re.Perl.compile_pat ~opts:[] "^([^.]+)")
~f:(fun __g__ ->
f
(match Re.Group.get_opt __g__ 1 with
None -> ""
| Some s -> s))
p)
in
String.concat "," ol
let fix0 txt =
Re.replace ~all:false (Re.Perl.compile_pat ~opts:[] "\"([^\"]+)\"")
~f:(fun __g__ ->
"\"" ^
fix
(match Re.Group.get_opt __g__ 1 with
None -> ""
| Some s -> s) ^
"\"")
txt
let fixdeps txt =
Re.replace ~all:true
(Re.Perl.compile_pat ~opts:[`Multiline] "^(.*require.*)$")
~f:(fun __g__ ->
fix0
(match Re.Group.get_opt __g__ 1 with
None -> ""
| Some s -> s))
txt
let capturex (cmd, args) =
let channel = Unix.open_process_args_in cmd args in
let txt = read_ic_fully ~channel () in close_in channel; txt
let _ =
if !direct_include <> "" then
print_string
(indent 2
(fixdeps
(R.failwith_error_msg
(read_fully
(v (String.concat "" ["./"; !direct_include; "/META"]))))))
let _ =
(!wrap_subdirs |> List.rev) |>
List.iter
(fun (name, subdir) ->
let txt =
indent 2
(fixdeps
(R.failwith_error_msg
(read_fully
(v (String.concat "" ["./"; subdir; "/META"])))))
in
print_string
(String.concat "" ["\npackage \""; name; "\" (\n"; txt; "\n)\n"]))
camlp5-camlp5-buildscripts-08f6a4a/src/ya-wrap-ocamlfind.PL 0000775 0000000 0000000 00000001644 15204417140 0023536 0 ustar 00root root 0000000 0000000 #!/usr/bin/env perl
use strict ;
use String::ShellQuote ;
our @cmd ;
our @files ;
while (@ARGV) {
if ($ARGV[0] eq "--") { shift @ARGV ; @files = @ARGV ; last ; }
elsif (int(@ARGV) == 1) {
@files = @ARGV ;
last ;
}
else { push(@cmd, shift @ARGV) ; }
}
{
@cmd = map { shell_quote($_) } @cmd ;
foreach my $f (@files) {
my $extra = discover_args($f) ;
my $cmd = "@cmd $extra $f\n" ;
print STDERR $cmd ;
system($cmd) ;
}
}
sub discover_args {
my $f = shift ;
open(F, "<$f") || die "$0: cannot open $f for read (to sense extra args)" ;
my $line1 = ;
close(F) ;
if ($line1 =~ m,^\(\*\*(.*?)\*\),) {
my $extra = $1 ;
$extra =~ s/(?:\$\(([^)]+)\)|\$\{([^}]+)\})/ envsubst($1, $2) /ge ;
return $extra ;
}
else {
return "" ;
}
}
sub envsubst {
my $varna = shift ;
die "env var $varna is not set"
unless exists $ENV{$varna} ;
return $ENV{$varna} ;
}
camlp5-camlp5-buildscripts-08f6a4a/src/ya_wrap_ocamlfind.ml 0000664 0000000 0000000 00000004217 15204417140 0023773 0 ustar 00root root 0000000 0000000 (** -syntax camlp5o *)
let rec split_args cmd =
function
"--" :: files -> List.rev cmd, files
| [file] -> List.rev cmd, [file]
| arg :: args -> split_args (arg :: cmd) args
| [] -> failwith "please supply input arguments"
let split_args = split_args []
let envsubst s =
let envlookup vname =
match Sys.getenv_opt vname with
Some v -> v
| None ->
failwith
(String.concat ""
["ya_wrap_ocamlfind: environment variable <<"; vname;
">> not found"])
in
let f s1 s2 =
if s1 <> "" then envlookup s1
else if s2 <> "" then envlookup s2
else assert false
in
Re.replace ~all:true
(Re.Perl.compile_pat ~opts:[] "(?:\\$\\(([^)]+)\\)|\\$\\{([^}]+)\\})")
~f:(fun __g__ ->
f
(match Re.Group.get_opt __g__ 1 with
None -> ""
| Some s -> s)
(match Re.Group.get_opt __g__ 2 with
None -> ""
| Some s -> s))
s
let discover_args f =
let f' = open_in f in
let rec drec () =
let line1 = input_line f' in
match
(let __re__ = Re.Perl.compile_pat ~opts:[] "^\\s+$" in
fun __subj__ -> Re.execp __re__ __subj__)
line1,
(let __re__ = Re.Perl.compile_pat ~opts:[] "^#.*$" in
fun __subj__ -> Re.execp __re__ __subj__)
line1,
(let __re__ = Re.Perl.compile_pat ~opts:[] "^\\(\\*\\*pp (.*?)\\*\\)" in
fun __subj__ ->
match
Option.map (fun __g__ -> Re.Group.get __g__ 1)
(Re.exec_opt __re__ __subj__)
with
exception Not_found -> None
| rv -> rv)
line1
with
true, _, _ -> drec ()
| _, true, _ -> drec ()
| _, _, None -> ""
| _, _, Some params -> envsubst params
in
let rv = drec () in close_in f'; rv
let () =
let (cmd, files) = (Array.to_list Sys.argv |> List.tl) |> split_args in
let cmd = Filename.quote_command (List.hd cmd) (List.tl cmd) in
List.iter
(fun f ->
let extra = discover_args f in
let cmd = String.concat "" [cmd; " "; extra; " "; f] in
Printf.fprintf stderr "%s\n%!" cmd;
let rc = Sys.command cmd in if rc <> 0 then exit rc)
files
camlp5-camlp5-buildscripts-08f6a4a/test/ 0000775 0000000 0000000 00000000000 15204417140 0020147 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/.gitignore 0000664 0000000 0000000 00000000023 15204417140 0022132 0 ustar 00root root 0000000 0000000 _build
*.corrected
camlp5-camlp5-buildscripts-08f6a4a/test/Makefile 0000664 0000000 0000000 00000000417 15204417140 0021611 0 ustar 00root root 0000000 0000000
FAIL=fail
TESTDIRS=simple packages $(FAIL)
all:
set -e; for i in $(TESTDIRS); do cd $$i; $(MAKE) all; cd ..; done
test::
set -e; for i in $(TESTDIRS); do cd $$i; $(MAKE) test; cd ..; done
clean::
set -e; for i in $(TESTDIRS); do cd $$i; $(MAKE) clean; cd ..; done
camlp5-camlp5-buildscripts-08f6a4a/test/fail/ 0000775 0000000 0000000 00000000000 15204417140 0021062 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/fail/Makefile 0000664 0000000 0000000 00000000775 15204417140 0022533 0 ustar 00root root 0000000 0000000 TOP=../..
EXE=$(shell ocamlc -config-var ext_exe)
all:
test::
rm -f FAILED
if [ -f FAILED ] ; then false; fi
ocamlfind fmt/NONEXISTENT || touch FAILED
if [ ! -f FAILED ] ; then false; fi
rm -f FAILED
TOP=$(TOP) ../../src/LAUNCH -- ocamlfind fmt/NONEXISTENT || touch FAILED
if [ ! -f FAILED ] ; then false; fi
rm -f FAILED
TOP=$(TOP) ../../src/LAUNCH -- ocamlfind camlp5-buildscripts/LAUNCH -- touch SUCCESS
if [ ! -f SUCCESS ] ; then false; fi
rm -f SUCCESS
echo "==== ALL PASSED ===="
clean::
camlp5-camlp5-buildscripts-08f6a4a/test/packages/ 0000775 0000000 0000000 00000000000 15204417140 0021725 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/packages/Makefile 0000664 0000000 0000000 00000000372 15204417140 0023367 0 ustar 00root root 0000000 0000000
TESTDIRS=foo bar test
all:
set -e; for i in $(TESTDIRS); do cd $$i; $(MAKE) all; cd ..; done
test::
set -e; for i in $(TESTDIRS); do cd $$i; $(MAKE) test; cd ..; done
clean::
set -e; for i in $(TESTDIRS); do cd $$i; $(MAKE) clean; cd ..; done
camlp5-camlp5-buildscripts-08f6a4a/test/packages/Makefile.config 0000664 0000000 0000000 00000000246 15204417140 0024633 0 ustar 00root root 0000000 0000000 EXE=$(shell ocamlc -config-var ext_exe)
LAUNCH=TOP=$(TOP) $(TOP)/src/LAUNCH$(EXE) -vv -- ocamlfind camlp5-buildscripts/LAUNCH$(EXE)
OCAMLFIND=$(LAUNCH) -- ocamlfind
camlp5-camlp5-buildscripts-08f6a4a/test/packages/bar/ 0000775 0000000 0000000 00000000000 15204417140 0022471 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/packages/bar/META 0000664 0000000 0000000 00000000134 15204417140 0023140 0 ustar 00root root 0000000 0000000 description = "haha"
requires = "foo"
archive(byte) = "bar.cmo"
archive(native) = "bar.cmx"
camlp5-camlp5-buildscripts-08f6a4a/test/packages/bar/Makefile 0000664 0000000 0000000 00000001120 15204417140 0024123 0 ustar 00root root 0000000 0000000 TOP=../../..
include $(TOP)/test/packages/Makefile.config
all: install
test:
install: bar.cmo bar.cmi bar.cmx bar.o buzz.cmo buzz.cmi buzz.cmx buzz.o
$(OCAMLFIND) install -destdir $(TOP)/local-install/lib bar META $^ || true
uninstall::
$(OCAMLFIND) remove -destdir $(TOP)/local-install/lib bar || true
bar.cmi bar.cmo bar.cmx bar.o:
$(OCAMLFIND) ocamlc -package foo -c bar.ml
$(OCAMLFIND) ocamlopt -package foo -c bar.ml
buzz.cmi buzz.cmo buzz.cmx buzz.o:
$(OCAMLFIND) ocamlc -package foo -c buzz.ml
$(OCAMLFIND) ocamlopt -package foo -c buzz.ml
clean:: uninstall
rm -f *.cm*
camlp5-camlp5-buildscripts-08f6a4a/test/packages/bar/bar.ml 0000664 0000000 0000000 00000000034 15204417140 0023564 0 ustar 00root root 0000000 0000000 let name = Foo.name ^ "bar"
camlp5-camlp5-buildscripts-08f6a4a/test/packages/bar/buzz.ml 0000664 0000000 0000000 00000000035 15204417140 0024013 0 ustar 00root root 0000000 0000000 let name = Foo.name ^ "buzz"
camlp5-camlp5-buildscripts-08f6a4a/test/packages/foo/ 0000775 0000000 0000000 00000000000 15204417140 0022510 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/packages/foo/META 0000664 0000000 0000000 00000000131 15204417140 0023154 0 ustar 00root root 0000000 0000000 description = "haha"
requires = ""
archive(byte) = "foo.cmo"
archive(native) = "foo.cmx"
camlp5-camlp5-buildscripts-08f6a4a/test/packages/foo/Makefile 0000664 0000000 0000000 00000000624 15204417140 0024152 0 ustar 00root root 0000000 0000000 TOP=../../..
include $(TOP)/test/packages/Makefile.config
all: install
test:
install: foo.cmo foo.cmi foo.cmx foo.o
$(OCAMLFIND) install -destdir $(TOP)/local-install/lib foo META $^ || true
uninstall::
$(OCAMLFIND) remove -destdir $(TOP)/local-install/lib foo || true
foo.cmi foo.cmo foo.cmx foo.o:
$(OCAMLFIND) ocamlc -c foo.ml
$(OCAMLFIND) ocamlopt -c foo.ml
clean:: uninstall
rm -f *.cm*
camlp5-camlp5-buildscripts-08f6a4a/test/packages/foo/foo.ml 0000664 0000000 0000000 00000000021 15204417140 0023616 0 ustar 00root root 0000000 0000000 let name = "foo"
camlp5-camlp5-buildscripts-08f6a4a/test/packages/test/ 0000775 0000000 0000000 00000000000 15204417140 0022704 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/packages/test/.gitignore 0000664 0000000 0000000 00000000027 15204417140 0024673 0 ustar 00root root 0000000 0000000 foobar
justfoo
andbuzz
camlp5-camlp5-buildscripts-08f6a4a/test/packages/test/Makefile 0000664 0000000 0000000 00000001300 15204417140 0024336 0 ustar 00root root 0000000 0000000 TOP=../../..
include $(TOP)/test/packages/Makefile.config
all: justfoo foobar andbuzz foobarbuzz
cp foobar $(TOP)/local-install/bin/foobar$(EXE)
cp foobar $(TOP)/local-install/bin/foobar$(EXE)
cp foobar $(TOP)/local-install/bin/foobar.opt$(EXE)
test:
foobar:
$(OCAMLFIND) ocamlc -verbose -package fmt,bar -linkall -linkpkg foobar.ml -o foobar$(EXE)
andbuzz:
$(OCAMLFIND) ocamlc -verbose -package bar -linkall -linkpkg buzz.cmo andbuzz.ml -o andbuzz
foobarbuzz:
$(OCAMLFIND) ocamlc -verbose -package fmt,bar -linkall -linkpkg foobar.ml -o foobar buzz.cmo
justfoo:
$(OCAMLFIND) ocamlc -verbose -package foo -linkall -linkpkg justfoo.ml -o justfoo
clean::
rm -f *.cm* foobar justfoo andbuzz
camlp5-camlp5-buildscripts-08f6a4a/test/packages/test/andbuzz.ml 0000664 0000000 0000000 00000000037 15204417140 0024713 0 ustar 00root root 0000000 0000000 Printf.printf "%s\n" Buzz.name
camlp5-camlp5-buildscripts-08f6a4a/test/packages/test/foobar.ml 0000664 0000000 0000000 00000000103 15204417140 0024500 0 ustar 00root root 0000000 0000000 Fmt.(pf stdout "%a@." Dump.(list string) (Array.to_list Sys.argv))
camlp5-camlp5-buildscripts-08f6a4a/test/packages/test/justfoo.ml 0000664 0000000 0000000 00000000036 15204417140 0024726 0 ustar 00root root 0000000 0000000 Printf.printf "%s\n" Foo.name
camlp5-camlp5-buildscripts-08f6a4a/test/simple/ 0000775 0000000 0000000 00000000000 15204417140 0021440 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/simple/.gitignore 0000664 0000000 0000000 00000000012 15204417140 0023421 0 ustar 00root root 0000000 0000000 *.output
camlp5-camlp5-buildscripts-08f6a4a/test/simple/LAUNCH.md 0000664 0000000 0000000 00000000425 15204417140 0022735 0 ustar 00root root 0000000 0000000 ```sh
$ ../../src/LAUNCH echo foo
Failure("LAUNCH: environment variable TOP *must* be set to use this wrapper")
[1]
```
```sh
$ env TOP=../.. ../../src/LAUNCH echo foo
foo
```
```sh
$ env TOP=../.. ../../src/LAUNCH -- ocamlfind camlp5-buildscripts/LAUNCH -- echo bar
bar
```
camlp5-camlp5-buildscripts-08f6a4a/test/simple/LAUNCH.sh 0000775 0000000 0000000 00000000464 15204417140 0022755 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
echo "================"
../../src/LAUNCH echo foo || echo expect-this
echo "================"
env TOP=../.. ../../src/LAUNCH echo foo
echo "================"
env TOP=../.. ../../src/LAUNCH -- ocamlfind camlp5-buildscripts/LAUNCH${EXE} -- echo bar
echo "================"
echo "DONE"
camlp5-camlp5-buildscripts-08f6a4a/test/simple/LAUNCH_win.sh 0000775 0000000 0000000 00000001063 15204417140 0023626 0 ustar 00root root 0000000 0000000 #!/bin/bash
echo "================"
../../src/LAUNCH.PL echo foo || echo expect-this-too
echo "================"
env TOP=../.. ../../src/LAUNCH.PL echo foo
echo "================"
env TOP=../.. ../../src/LAUNCH.PL ocamlfind camlp5-buildscripts/LAUNCH${EXE} echo bar2
echo "================"
BSDIR=`env TOP=../.. ../../src/LAUNCH.PL ocamlfind query camlp5-buildscripts`
env TOP=../.. ${BSDIR}/LAUNCH.PL echo bar3
echo "================"
env TOP=../.. ../../src/LAUNCH.PL ocamlfind camlp5-buildscripts/LAUNCH.PL echo bar4
echo "================"
echo "DONE"
camlp5-camlp5-buildscripts-08f6a4a/test/simple/Makefile 0000664 0000000 0000000 00000000737 15204417140 0023107 0 ustar 00root root 0000000 0000000
export EXE=$(shell ocamlc -config-var ext_exe)
TESTS=LAUNCH join_meta ya-wrap-ocamlfind
all:
test: $(TESTS)
./LAUNCH.sh
./LAUNCH.sh > LAUNCH.sh.output 2>&1
ifneq ($(OS),Windows_NT)
diff -Bwiu t/LAUNCH/LAUNCH.sh.expected LAUNCH.sh.output
else
./LAUNCH_win.sh
endif
%: %.md
rm -f $<.corrected
ocaml-mdx test --force-output $<
ifneq ($(OS),Windows_NT)
test '!' -f $<.corrected || diff -I stublibs -I '```' -Bwiu $< $<.corrected
endif
clean::
rm -f *.corrected *.output
camlp5-camlp5-buildscripts-08f6a4a/test/simple/join_meta.md 0000664 0000000 0000000 00000005133 15204417140 0023731 0 ustar 00root root 0000000 0000000 ```sh
$ ../../src/join_meta -rewrite pa_ppx_regexp_runtime:pa_ppx_regexp.runtime -direct-include t/join_meta/pa_perl -wrap-subdir runtime:t/join_meta/runtime
# Specifications for the "pa_ppx_regexp" preprocessor:
requires = "camlp5,fmt,re,pa_ppx.base,pa_ppx_regexp.runtime,camlp5.parser_quotations"
version = "0.01"
description = "pa_ppx_regexp: pa_ppx_regexp rewriter"
# For linking
package "link" (
requires = "camlp5,fmt,re,pa_ppx.base.link,camlp5.parser_quotations.link"
archive(byte) = "pa_ppx_regexp.cma"
archive(native) = "pa_ppx_regexp.cmxa"
)
# For the toploop:
archive(byte,toploop) = "pa_ppx_regexp.cma"
# For the preprocessor itself:
requires(syntax,preprocessor) = "camlp5,fmt,re,pa_ppx.base,camlp5.parser_quotations"
archive(syntax,preprocessor,-native) = "pa_ppx_regexp.cma"
archive(syntax,preprocessor,native) = "pa_ppx_regexp.cmxa"
package "runtime" (
# Specifications for the "pa_ppx_regexp_runtime" package:
requires = "fmt"
version = "0.01"
description = "pa_ppx_regexp runtime support"
# For linking
archive(byte) = "pa_ppx_regexp_runtime.cma"
archive(native) = "pa_ppx_regexp_runtime.cmxa"
# For the toploop:
archive(byte,toploop) = "pa_ppx_regexp_runtime.cma"
)
```
```sh
$ env TOP=../.. ../../src/LAUNCH -- ocamlfind camlp5-buildscripts/join_meta -rewrite pa_ppx_regexp_runtime:pa_ppx_regexp.runtime -direct-include t/join_meta/pa_perl -wrap-subdir runtime:t/join_meta/runtime
# Specifications for the "pa_ppx_regexp" preprocessor:
requires = "camlp5,fmt,re,pa_ppx.base,pa_ppx_regexp.runtime,camlp5.parser_quotations"
version = "0.01"
description = "pa_ppx_regexp: pa_ppx_regexp rewriter"
# For linking
package "link" (
requires = "camlp5,fmt,re,pa_ppx.base.link,camlp5.parser_quotations.link"
archive(byte) = "pa_ppx_regexp.cma"
archive(native) = "pa_ppx_regexp.cmxa"
)
# For the toploop:
archive(byte,toploop) = "pa_ppx_regexp.cma"
# For the preprocessor itself:
requires(syntax,preprocessor) = "camlp5,fmt,re,pa_ppx.base,camlp5.parser_quotations"
archive(syntax,preprocessor,-native) = "pa_ppx_regexp.cma"
archive(syntax,preprocessor,native) = "pa_ppx_regexp.cmxa"
package "runtime" (
# Specifications for the "pa_ppx_regexp_runtime" package:
requires = "fmt"
version = "0.01"
description = "pa_ppx_regexp runtime support"
# For linking
archive(byte) = "pa_ppx_regexp_runtime.cma"
archive(native) = "pa_ppx_regexp_runtime.cmxa"
# For the toploop:
archive(byte,toploop) = "pa_ppx_regexp_runtime.cma"
)
```
camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/ 0000775 0000000 0000000 00000000000 15204417140 0021703 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/LAUNCH/ 0000775 0000000 0000000 00000000000 15204417140 0022655 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/LAUNCH/LAUNCH.sh.expected 0000664 0000000 0000000 00000000253 15204417140 0025763 0 ustar 00root root 0000000 0000000 ================
Failure("LAUNCH: environment variable TOP *must* be set to use this wrapper")
expect-this
================
foo
================
bar
================
DONE
camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/join_meta/ 0000775 0000000 0000000 00000000000 15204417140 0023650 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/join_meta/pa_perl/ 0000775 0000000 0000000 00000000000 15204417140 0025272 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/join_meta/pa_perl/META 0000664 0000000 0000000 00000001300 15204417140 0025735 0 ustar 00root root 0000000 0000000
# Specifications for the "pa_ppx_regexp" preprocessor:
requires = "camlp5,fmt,re,pa_ppx.base,pa_ppx_regexp_runtime,camlp5.parser_quotations"
version = "0.01"
description = "pa_ppx_regexp: pa_ppx_regexp rewriter"
# For linking
package "link" (
requires = "camlp5,fmt,re,pa_ppx.base.link,camlp5.parser_quotations.link"
archive(byte) = "pa_ppx_regexp.cma"
archive(native) = "pa_ppx_regexp.cmxa"
)
# For the toploop:
archive(byte,toploop) = "pa_ppx_regexp.cma"
# For the preprocessor itself:
requires(syntax,preprocessor) = "camlp5,fmt,re,pa_ppx.base,camlp5.parser_quotations"
archive(syntax,preprocessor,-native) = "pa_ppx_regexp.cma"
archive(syntax,preprocessor,native) = "pa_ppx_regexp.cmxa"
camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/join_meta/pa_ppx_regexp_runtime/ 0000775 0000000 0000000 00000000000 15204417140 0030254 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/join_meta/pa_ppx_regexp_runtime/META 0000664 0000000 0000000 00000000476 15204417140 0030734 0 ustar 00root root 0000000 0000000
# Specifications for the "pa_ppx_regexp_runtime" package:
requires = "fmt"
version = "0.01"
description = "pa_ppx_regexp runtime support"
# For linking
archive(byte) = "pa_ppx_regexp_runtime.cma"
archive(native) = "pa_ppx_regexp_runtime.cmxa"
# For the toploop:
archive(byte,toploop) = "pa_ppx_regexp_runtime.cma"
camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/join_meta/runtime/ 0000775 0000000 0000000 00000000000 15204417140 0025333 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/join_meta/runtime/META 0000664 0000000 0000000 00000000476 15204417140 0026013 0 ustar 00root root 0000000 0000000
# Specifications for the "pa_ppx_regexp_runtime" package:
requires = "fmt"
version = "0.01"
description = "pa_ppx_regexp runtime support"
# For linking
archive(byte) = "pa_ppx_regexp_runtime.cma"
archive(native) = "pa_ppx_regexp_runtime.cmxa"
# For the toploop:
archive(byte,toploop) = "pa_ppx_regexp_runtime.cma"
camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/ya-wrap-ocamlfind/ 0000775 0000000 0000000 00000000000 15204417140 0025215 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/ya-wrap-ocamlfind/after-cppo.ml 0000664 0000000 0000000 00000000175 15204417140 0027612 0 ustar 00root root 0000000 0000000 # 1 "test_utils.ml"
(**pp -syntax camlp5o -package $(PAPACKAGES) *)
(* Copyright 2019 Chetan Murthy, All rights reserved. *)
camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/ya-wrap-ocamlfind/before-cppo.ml 0000664 0000000 0000000 00000000244 15204417140 0027750 0 ustar 00root root 0000000 0000000 #ifdef PAPPX
(**pp -syntax camlp5o -package $(PAPACKAGES) *)
#else
(**pp -package $(PPXPACKAGES) *)
#endif
(* Copyright 2019 Chetan Murthy, All rights reserved. *)
camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/ya-wrap-ocamlfind/simple.ml 0000664 0000000 0000000 00000000042 15204417140 0027034 0 ustar 00root root 0000000 0000000 (**pp -syntax goober *)
let x = 1
camlp5-camlp5-buildscripts-08f6a4a/test/simple/t/ya-wrap-ocamlfind/use_str.ml 0000664 0000000 0000000 00000000072 15204417140 0027232 0 ustar 00root root 0000000 0000000 (**pp -package str *)
open Str
let re = Str.regexp "foo"
camlp5-camlp5-buildscripts-08f6a4a/test/simple/ya-wrap-ocamlfind.md 0000664 0000000 0000000 00000004253 15204417140 0025300 0 ustar 00root root 0000000 0000000 ```sh
$ ../../src/ya-wrap-ocamlfind echo t/ya-wrap-ocamlfind/simple.ml
'echo' -syntax goober t/ya-wrap-ocamlfind/simple.ml
-syntax goober t/ya-wrap-ocamlfind/simple.ml
```
```sh
$ rm -f t/ya-wrap-ocamlfind/use_str.cm*
$ ../../src/ya-wrap-ocamlfind ocamlfind ocamlc -c t/ya-wrap-ocamlfind/use_str.ml
'ocamlfind' 'ocamlc' '-c' -package str t/ya-wrap-ocamlfind/use_str.ml
$ ls t/ya-wrap-ocamlfind/use_str.cm*
t/ya-wrap-ocamlfind/use_str.cmi
t/ya-wrap-ocamlfind/use_str.cmo
```
```sh
$ rm -f t/ya-wrap-ocamlfind/use_str.cm*
$ TOP=../.. ../../src/LAUNCH -v -- ocamlfind camlp5-buildscripts/ya-wrap-ocamlfind ocamlfind ocamlc -c t/ya-wrap-ocamlfind/use_str.ml
LAUNCH: command 'ocamlfind' 'camlp5-buildscripts/ya-wrap-ocamlfind' 'ocamlfind' 'ocamlc' '-c' 't/ya-wrap-ocamlfind/use_str.ml'
'ocamlfind' 'ocamlc' '-c' -package str t/ya-wrap-ocamlfind/use_str.ml
$ ls t/ya-wrap-ocamlfind/use_str.cm*
t/ya-wrap-ocamlfind/use_str.cmi
t/ya-wrap-ocamlfind/use_str.cmo
```
```sh
$ PAPACKAGES=foo,bar ../../src/ya-wrap-ocamlfind echo t/ya-wrap-ocamlfind/after-cppo.ml
'echo' -syntax camlp5o -package foo,bar t/ya-wrap-ocamlfind/after-cppo.ml
-syntax camlp5o -package foo,bar t/ya-wrap-ocamlfind/after-cppo.ml
```
```sh
$ rm -rf _build && mkdir -p _build
```
```sh
$ cppo -D PAPPX t/ya-wrap-ocamlfind/before-cppo.ml > _build/cppo.pappx.ml
$ PAPACKAGES=foo,bar PPXPACKAGES=buzz,fuzz ../../src/ya-wrap-ocamlfind echo _build/cppo.pappx.ml
'echo' -syntax camlp5o -package foo,bar _build/cppo.pappx.ml
-syntax camlp5o -package foo,bar _build/cppo.pappx.ml
$ cat _build/cppo.pappx.ml
# 2 "t/ya-wrap-ocamlfind/before-cppo.ml"
(**pp -syntax camlp5o -package $(PAPACKAGES) *)
# 6 "t/ya-wrap-ocamlfind/before-cppo.ml"
(* Copyright 2019 Chetan Murthy, All rights reserved. *)
```
```sh
$ cppo -U PAPPX t/ya-wrap-ocamlfind/before-cppo.ml > _build/cppo.ppx.ml
$ PAPACKAGES=foo,bar PPXPACKAGES=buzz,fuzz ../../src/ya-wrap-ocamlfind echo _build/cppo.ppx.ml
'echo' -package buzz,fuzz _build/cppo.ppx.ml
-package buzz,fuzz _build/cppo.ppx.ml
$ cat _build/cppo.ppx.ml
# 4 "t/ya-wrap-ocamlfind/before-cppo.ml"
(**pp -package $(PPXPACKAGES) *)
# 6 "t/ya-wrap-ocamlfind/before-cppo.ml"
(* Copyright 2019 Chetan Murthy, All rights reserved. *)
```
camlp5-camlp5-buildscripts-08f6a4a/tools/ 0000775 0000000 0000000 00000000000 15204417140 0020330 5 ustar 00root root 0000000 0000000 camlp5-camlp5-buildscripts-08f6a4a/tools/Config.pm 0000664 0000000 0000000 00000006772 15204417140 0022107 0 ustar 00root root 0000000 0000000 $CPAN::Config = {
'allow_installing_module_downgrades' => 'ask/no',
'allow_installing_outdated_dists' => 'ask/no',
'applypatch' => '',
'auto_commit' => '0',
'build_cache' => '100',
'build_dir' => '/cygdrive/c/Users/runneradmin/.cpan/build',
'build_dir_reuse' => '0',
'build_requires_install_policy' => 'yes',
'bzip2' => '/usr/bin/bzip2',
'cache_metadata' => '1',
'check_sigs' => '0',
'cleanup_after_install' => '0',
'colorize_output' => '0',
'commandnumber_in_prompt' => '1',
'connect_to_internet_ok' => '1',
'cpan_home' => '/cygdrive/c/Users/runneradmin/.cpan',
'curl' => '/usr/bin/curl',
'ftp_passive' => '1',
'ftp_proxy' => '',
'getcwd' => 'cwd',
'gpg' => '/cygdrive/c/Program Files/Git/usr/bin/gpg',
'gzip' => '/usr/bin/gzip',
'halt_on_failure' => '0',
'histfile' => '/cygdrive/c/Users/runneradmin/.cpan/histfile',
'histsize' => '100',
'http_proxy' => '',
'inactivity_timeout' => '0',
'index_expire' => '1',
'inhibit_startup_message' => '0',
'keep_source_where' => '/cygdrive/c/Users/runneradmin/.cpan/sources',
'load_module_verbosity' => 'none',
'make' => '/usr/bin/make',
'make_arg' => '',
'make_install_arg' => '',
'make_install_make_command' => '/usr/bin/make',
'makepl_arg' => '',
'mbuild_arg' => '',
'mbuild_install_arg' => '',
'mbuild_install_build_command' => './Build',
'mbuildpl_arg' => '',
'no_proxy' => '',
'pager' => '/usr/bin/less',
'patch' => '/usr/bin/patch',
'perl5lib_verbosity' => 'none',
'prefer_external_tar' => '1',
'prefer_installer' => 'MB',
'prefs_dir' => '/cygdrive/c/Users/runneradmin/.cpan/prefs',
'prerequisites_policy' => 'follow',
'pushy_https' => '1',
'recommends_policy' => '1',
'scan_cache' => 'atstart',
'shell' => '/bin/bash',
'show_unparsable_versions' => '0',
'show_upload_date' => '0',
'show_zero_versions' => '0',
'suggests_policy' => '0',
'tar' => '/usr/bin/tar',
'tar_verbosity' => 'none',
'term_is_latin' => '1',
'term_ornaments' => '1',
'test_report' => '0',
'trust_test_report_history' => '0',
'unzip' => '/usr/bin/unzip',
'urllist' => [
'https://cpan.org/'
],
'use_prompt_default' => '0',
'use_sqlite' => '0',
'version_timeout' => '15',
'wget' => '',
'yaml_load_code' => '0',
'yaml_module' => 'YAML'
};
1;
__END__