SPB Git

Repository Public License

normalize-xcframework.sh 1.1 KB 20 lines shellscript

1#!/usr/bin/env bash2# ORIX Convert — EmbeddedEngines/normalize-xcframework.sh3# Description: Moves an xcframework's top-level Headers/module.modulemap into Headers/<Module>/module.modulemap4#              (header paths rewritten to "../…"). Xcode copies every static xcframework's Headers into one shared5#              include directory, so several top-level module.modulemap files collide; headers stay where they are6#              so `#include <lib/header.h>` keeps working. Idempotent. Usage: normalize-xcframework.sh <x.xcframework>…7# Author: Simon-Pierre Boucher — contact@spboucher.ai8set -euo pipefail9for xc in "$@"; do10  while IFS= read -r map; do11    dir="$(dirname "$map")"12    module="$(sed -n 's/^[[:space:]]*module[[:space:]]\{1,\}\([A-Za-z0-9_]*\).*/\1/p' "$map" | head -1)"13    [[ -n "$module" ]] || { echo "no module name in $map" >&2; exit 1; }14    mkdir -p "$dir/$module"15    sed 's|header "\([^"]*\)"|header "../\1"|' "$map" > "$dir/$module/module.modulemap"16    rm "$map"17    echo "normalized $xc ($module)"18  done < <(find "$xc" -path '*/Headers/module.modulemap')19done20
Files main
Menu

Theme