|
97 | 97 | else
|
98 | 98 | LIB_EXT=so
|
99 | 99 | fi
|
100 |
| - cp out.gn/$V8CONFIG/lib*.${LIB_EXT} out.gn/$V8CONFIG/*_blob.bin out.gn/$V8CONFIG/icudtl.dat /opt/v8/self-built/lib/ |
| 100 | + # Copy all V8 libraries and support files |
| 101 | + cp -v out.gn/$V8CONFIG/lib*.${LIB_EXT}* out.gn/$V8CONFIG/*_blob.bin out.gn/$V8CONFIG/icudtl.dat /opt/v8/self-built/lib/ |
| 102 | + # Copy all V8 static libraries as well |
| 103 | + cp -v out.gn/$V8CONFIG/obj/libv8_*.a /opt/v8/self-built/lib/ 2>/dev/null || true |
| 104 | + # Copy headers |
101 | 105 | cp -R include/* /opt/v8/self-built/include/
|
| 106 | + # Create symlinks for libraries without version numbers |
| 107 | + cd /opt/v8/self-built/lib/ |
| 108 | + for lib in lib*.${LIB_EXT}.*; do |
| 109 | + if [[ $lib == *\.${LIB_EXT}.* ]]; then |
| 110 | + ln -sf $lib ${lib%%.*} 2>/dev/null || true |
| 111 | + fi |
| 112 | + done |
| 113 | + # Set library search path |
| 114 | + if [[ "${{ runner.os }}" == "Linux" ]]; then |
| 115 | + echo "/opt/v8/self-built/lib" | sudo tee /etc/ld.so.conf.d/v8.conf |
| 116 | + sudo ldconfig |
| 117 | + elif [[ "${{ runner.os }}" == "macOS" ]]; then |
| 118 | + # On macOS, update DYLD_LIBRARY_PATH for the current session |
| 119 | + echo "DYLD_LIBRARY_PATH=/opt/v8/self-built/lib" >> $GITHUB_ENV |
| 120 | + # Also create symlinks in /usr/local/lib for system-wide access |
| 121 | + sudo mkdir -p /usr/local/lib/v8 |
| 122 | + sudo ln -sf /opt/v8/self-built/lib/*.dylib* /usr/local/lib/v8/ |
| 123 | + fi |
102 | 124 |
|
103 | 125 | # Go back to origin
|
104 | 126 | cd "${GITHUB_WORKSPACE}"
|
@@ -158,9 +180,46 @@ jobs:
|
158 | 180 |
|
159 | 181 | - name: Build extension
|
160 | 182 | run: |
|
| 183 | + # Set library paths based on OS |
| 184 | + if [[ "${{ runner.os }}" == "Linux" ]]; then |
| 185 | + export LD_LIBRARY_PATH="/opt/v8/self-built/lib:${LD_LIBRARY_PATH:-}" |
| 186 | + # Ensure linker can find the libraries |
| 187 | + echo "/opt/v8/self-built/lib" | sudo tee /etc/ld.so.conf.d/v8js.conf |
| 188 | + sudo ldconfig |
| 189 | + echo "=== Library search paths ===" |
| 190 | + ldconfig -p | grep v8 || true |
| 191 | + elif [[ "${{ runner.os }}" == "macOS" ]]; then |
| 192 | + export DYLD_LIBRARY_PATH="/opt/v8/self-built/lib:${DYLD_LIBRARY_PATH:-}" |
| 193 | + fi |
| 194 | + |
| 195 | + # List V8 libraries for debugging |
| 196 | + echo "=== Available V8 libraries ===" |
| 197 | + ls -la /opt/v8/self-built/lib/ |
| 198 | + |
| 199 | + # Build the extension |
161 | 200 | phpize
|
162 |
| - ./configure --with-v8js=/opt/v8/self-built LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX" |
163 |
| - make |
| 201 | + |
| 202 | + # Configure with explicit library paths |
| 203 | + echo "=== Running configure ===" |
| 204 | + ./configure \ |
| 205 | + --with-v8js=/opt/v8/self-built \ |
| 206 | + LDFLAGS="-L/opt/v8/self-built/lib -Wl,-rpath=/opt/v8/self-built/lib" \ |
| 207 | + CPPFLAGS="-I/opt/v8/self-built/include -DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX" \ |
| 208 | + LIBS="-lstdc++" \ |
| 209 | + V8_LIBS="-L/opt/v8/self-built/lib -lv8 -lv8_libplatform -lv8_libbase -lstdc++ -lpthread -ldl" |
| 210 | + |
| 211 | + # Build with verbose output |
| 212 | + echo "=== Building extension ===" |
| 213 | + make -j$(nproc) V=1 |
| 214 | + |
| 215 | + # Verify the linked libraries |
| 216 | + if [[ "${{ runner.os }}" == "Linux" ]]; then |
| 217 | + echo "=== Checking linked libraries ===" |
| 218 | + ldd modules/v8js.so | grep -i v8 || true |
| 219 | + fi |
| 220 | + |
| 221 | + # Run tests |
| 222 | + echo "=== Running tests ===" |
164 | 223 | make test
|
165 | 224 |
|
166 | 225 | - name: Archive test results
|
|
0 commit comments