|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Generate itk_wasm_env_vars.sh for use in Docker builds |
| 4 | +# This script sources the root itk_wasm_env.bash and extracts only |
| 5 | +# the variables needed by the Dockerfile |
| 6 | + |
| 7 | +set -eo pipefail |
| 8 | + |
| 9 | +script_dir="$(cd "$(dirname "$0")" && pwd)" |
| 10 | +root_dir="$(cd "$script_dir/../../.." && pwd)" |
| 11 | + |
| 12 | +# Source the main environment file |
| 13 | +# Note: We need to handle the fact that itk_wasm_env.bash tries to parse |
| 14 | +# package.json files which may not work in all contexts |
| 15 | +export ITK_WASM_DEV_DOCKER_TAG="${ITK_WASM_DEV_DOCKER_TAG:-latest}" |
| 16 | + |
| 17 | +# Extract the core variables we need |
| 18 | +source "$root_dir/itk_wasm_env.bash" 2>/dev/null || { |
| 19 | + # If sourcing fails (e.g., due to jq commands), extract manually |
| 20 | + ITK_WASM_DCMTK_REPOSITORY="${ITK_WASM_DCMTK_REPOSITORY:-https://github.com/InsightSoftwareConsortium/DCMTK}" |
| 21 | + ITK_WASM_DCMTK_GIT_TAG="${ITK_WASM_DCMTK_GIT_TAG:-2fe4dacbe9c343dba350fcff6eab365241636623}" |
| 22 | + ITK_WASM_ITK_REPOSITORY="${ITK_WASM_ITK_REPOSITORY:-https://github.com/thewtex/ITK}" |
| 23 | + ITK_WASM_ITK_BRANCH="${ITK_WASM_ITK_BRANCH:-itkwasm-2025-03-19-25d3162371}" |
| 24 | +} |
| 25 | + |
| 26 | +# Generate the env vars file for Docker |
| 27 | +cat > "$script_dir/itk_wasm_env_vars.sh" << EOF |
| 28 | +#!/usr/bin/env sh |
| 29 | +# Auto-generated by generate-env-vars.sh - DO NOT EDIT |
| 30 | +# Generated from: $root_dir/itk_wasm_env.bash |
| 31 | +
|
| 32 | +export ITK_WASM_DCMTK_REPOSITORY="${ITK_WASM_DCMTK_REPOSITORY}" |
| 33 | +export ITK_WASM_DCMTK_GIT_TAG="${ITK_WASM_DCMTK_GIT_TAG}" |
| 34 | +export ITK_WASM_ITK_REPOSITORY="${ITK_WASM_ITK_REPOSITORY}" |
| 35 | +export ITK_WASM_ITK_BRANCH="${ITK_WASM_ITK_BRANCH}" |
| 36 | +EOF |
| 37 | + |
| 38 | +chmod +x "$script_dir/itk_wasm_env_vars.sh" |
| 39 | + |
| 40 | +echo "Generated $script_dir/itk_wasm_env_vars.sh with:" |
| 41 | +echo " ITK_WASM_ITK_REPOSITORY=${ITK_WASM_ITK_REPOSITORY}" |
| 42 | +echo " ITK_WASM_ITK_BRANCH=${ITK_WASM_ITK_BRANCH}" |
| 43 | +echo " ITK_WASM_DCMTK_REPOSITORY=${ITK_WASM_DCMTK_REPOSITORY}" |
| 44 | +echo " ITK_WASM_DCMTK_GIT_TAG=${ITK_WASM_DCMTK_GIT_TAG}" |
0 commit comments