MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1
fork

Configure Feed

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

at type-hints-typescript 79 lines 1.8 kB view raw
1#!/bin/bash 2set -e 3 4. "$(dirname "$0")/common.sh" 5 6DIST_DIR="$SCRIPT_DIR/dist" 7mkdir -p "$DIST_DIR" 8 9bundle_lib() { 10 NAME="$1" 11 EXCLUDE="$2" 12 OUTPUT="$BUILD_DIR/$NAME" 13 14 echo "Bundling $NAME..." 15 16 TMPDIR=$(mktemp -d) 17 18 LIBS=$(find "$BUILD_DIR" -name '*.a' \ 19 ! -name 'libant.a' \ 20 ! -name 'libant-lto.a' \ 21 ! -name 'libpkg.a' \ 22 ! -path '*/oxc-target/release/deps/*' \ 23 ! -path '*/.external/*' \ 24 2>/dev/null | grep -E -v "$EXCLUDE" | sort -u) 25 26 cd "$TMPDIR" 27 for lib in $LIBS; do 28 libname=$(basename "$lib" .a) 29 mkdir -p "$libname" 30 (cd "$libname" && llvm-ar x "$lib" 2>/dev/null || ar x "$lib") 31 done 32 33 find . -name '*.o' > objects.txt 34 35 if [ ! -s objects.txt ]; then 36 echo "No objects found, skipping $NAME" 37 rm -rf "$TMPDIR" 38 cd "$SCRIPT_DIR" 39 return 40 fi 41 42 if command -v llvm-ar >/dev/null 2>&1; then 43 llvm-ar rcs "$OUTPUT" $(cat objects.txt) 44 else 45 ar rcs "$OUTPUT" $(cat objects.txt) 46 fi 47 48 rm -rf "$TMPDIR" 49 cd "$SCRIPT_DIR" 50 51 cp "$OUTPUT" "$DIST_DIR/" 52 echo "Created: $DIST_DIR/$NAME ($(du -h "$OUTPUT" | cut -f1))" 53} 54 55bundle_lib "libant.a" "_lto" 56 57if [ -f "$BUILD_DIR/libant_core_lto.a" ]; then 58 bundle_lib "libant-lto.a" "libant_core.a" 59fi 60 61if [ -f "$BUILD_DIR/libant.h" ]; then 62 cp "$BUILD_DIR/libant.h" "$DIST_DIR/ant.h" 63 echo "Created: $DIST_DIR/ant.h" 64fi 65 66pkg_lib_path=$(find "$BUILD_DIR" -name 'libpkg.a' -print | head -n 1) 67if [ -n "$pkg_lib_path" ] && [ -f "$pkg_lib_path" ]; then 68 cp "$pkg_lib_path" "$DIST_DIR/libpkg.a" 69 echo "Created: $DIST_DIR/libpkg.a ($(du -h "$pkg_lib_path" | cut -f1))" 70fi 71 72if [ -f "$ROOT_DIR/include/pkg.h" ]; then 73 cp "$ROOT_DIR/include/pkg.h" "$DIST_DIR/pkg.h" 74 echo "Created: $DIST_DIR/pkg.h" 75fi 76 77echo "" 78echo "Done! Distribution files in $DIST_DIR:" 79ls -lh "$DIST_DIR"/ 2>/dev/null || echo "No files found"