9494 ninja -j$(nproc)
9595
9696 - name : Install LLVM
97+ if : steps.cache-llvm.outputs.cache-hit != 'true'
9798 run : |
9899 cd build-static
99100 ninja install
@@ -107,50 +108,55 @@ jobs:
107108 mkdir -p artifact-package/{lib,include,bin}
108109
109110 INSTALL_DIR="${{ github.workspace }}/llvm-install"
111+ BUILD_DIR="${{ github.workspace }}/build-static"
110112
111- echo "📦 Packaging LLVM artifacts from: $INSTALL_DIR "
113+ echo "📦 Packaging LLVM artifacts"
112114
113- # Copy all static libraries
115+ # Determine source directory (install if available, otherwise build)
114116 if [ -d "$INSTALL_DIR/lib" ]; then
117+ SRC_DIR="$INSTALL_DIR"
118+ echo "Using install directory: $SRC_DIR"
119+ elif [ -d "$BUILD_DIR/lib" ]; then
120+ SRC_DIR="$BUILD_DIR"
121+ echo "Using build directory: $SRC_DIR"
122+ else
123+ echo "❌ No valid source directory found"
124+ exit 1
125+ fi
126+
127+ # Copy all static libraries
128+ if [ -d "$SRC_DIR/lib" ]; then
115129 echo "Copying static libraries..."
116- find "$INSTALL_DIR /lib" -name "*.a" -exec cp -v {} artifact-package/lib/ \;
117- echo "✓ Libraries copied: $(ls artifact-package/lib/*.a | wc -l) files"
130+ find "$SRC_DIR /lib" -name "*.a" -exec cp -v {} artifact-package/lib/ \;
131+ echo "✓ Libraries copied: $(ls artifact-package/lib/*.a 2>/dev/null | wc -l) files"
118132 fi
119133
120- # Copy headers
121- if [ -d "$INSTALL_DIR/include" ]; then
122- echo "Copying headers..."
123- cp -r "$INSTALL_DIR/include"/* artifact-package/include/
124- echo "✓ Headers copied"
134+ # Copy headers from both install and source
135+ if [ -d "$SRC_DIR/include" ]; then
136+ echo "Copying headers from $SRC_DIR..."
137+ cp -r "$SRC_DIR/include"/* artifact-package/include/
138+ fi
139+ if [ -d "llvm/include" ]; then
140+ echo "Copying headers from source..."
141+ cp -r llvm/include/* artifact-package/include/
125142 fi
126143
127144 # Copy essential LLVM tools
128145 echo "Copying LLVM tools..."
129146 for tool in llvm-config llc llvm-as llvm-dis llvm-link opt llvm-ar llvm-nm; do
130- if [ -f "$INSTALL_DIR/bin/$tool" ]; then
131- cp -v "$INSTALL_DIR/bin/$tool" artifact-package/bin/
147+ if [ -f "$SRC_DIR/bin/$tool" ]; then
148+ cp -v "$SRC_DIR/bin/$tool" artifact-package/bin/
149+ chmod +x artifact-package/bin/$tool
132150 echo "✓ Copied $tool"
133151 else
134- echo "⚠️ $tool not found"
152+ echo "⚠️ $tool not found in $SRC_DIR/bin/ "
135153 fi
136154 done
137155
138- # Also check build directory for tools
139- if [ ! -f "artifact-package/bin/llvm-config" ]; then
140- echo "Trying to copy from build directory..."
141- if [ -f "build-static/bin/llvm-config" ]; then
142- for tool in llvm-config llc llvm-as llvm-dis llvm-link opt llvm-ar llvm-nm; do
143- if [ -f "build-static/bin/$tool" ]; then
144- cp -v "build-static/bin/$tool" artifact-package/bin/
145- fi
146- done
147- fi
148- fi
149-
150156 # Verify binaries are present
151157 echo ""
152158 echo "📋 Final artifact contents:"
153- ls -lh artifact-package/bin/
159+ ls -lh artifact-package/bin/ || echo "No binaries found"
154160 echo ""
155161 echo "Library count: $(ls artifact-package/lib/*.a 2>/dev/null | wc -l)"
156162
0 commit comments