Ver Fonte

Support compiling v8js with v8 in a custom path.

If you don't want to overwrite the system copy of v8 in /usr/lib/libv8.so,
you can use the --with-v8=<path> option to have php-v8js use its own
copy of libv8.
C. Scott Ananian há 11 anos atrás
pai
commit
1f2eefdbea
2 ficheiros alterados com 11 adições e 2 exclusões
  1. 5 0
      README.md
  2. 6 2
      config.m4

+ 5 - 0
README.md

@@ -33,11 +33,16 @@ git clone https://github.com/v8/v8.git
 cd v8
 make dependencies
 make native library=shared -j8
+sudo mkdir -p /usr/lib /usr/include
 sudo cp out/native/lib.target/libv8.so /usr/lib/libv8.so
 sudo cp include/v8* /usr/include
 
 ```
 
+If you don't want to overwrite the system copy of v8, replace `/usr` in
+the above commands with `/tmp/v8-install` and then add
+`--with-v8js=/tmp/v8-install` to the php-v8js `./configure` command below.
+
 Compile php-v8js itself
 -----------------------
 

+ 6 - 2
config.m4

@@ -5,9 +5,10 @@ PHP_ARG_WITH(v8js, for V8 Javascript Engine,
 
 if test "$PHP_V8JS" != "no"; then
   SEARCH_PATH="/usr/local /usr"
-  SEARCH_FOR="/include/v8.h"
+  SEARCH_FOR="include/v8.h"
   
   if test -r $PHP_V8JS/$SEARCH_FOR; then
+    LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8JS/$PHP_LIBDIR"
     V8_DIR=$PHP_V8JS
   else
     AC_MSG_CHECKING([for V8 files in default path])
@@ -32,8 +33,10 @@ if test "$PHP_V8JS" != "no"; then
   AC_CACHE_CHECK(for V8 version, ac_cv_v8_version, [
 old_LIBS=$LIBS
 old_LDFLAGS=$LDFLAGS
-LDFLAGS=-L$V8_DIR/$PHP_LIBDIR
+old_CPPFLAGS=$CPPFLAGS
+LDFLAGS="-Wl,--rpath=$V8_DIR/$PHP_LIBDIR -L$V8_DIR/$PHP_LIBDIR"
 LIBS=-lv8
+CPPFLAGS=-I$V8_DIR/include
 AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
 AC_TRY_RUN([#include <v8.h>
@@ -55,6 +58,7 @@ int main ()
 AC_LANG_RESTORE
 LIBS=$old_LIBS
 LDFLAGS=$old_LDFLAGS
+CPPFLAGS=$old_CPPFLAGS
 ])
 
   if test "$ac_cv_v8_version" != "NONE"; then